home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 40,925 of 42,547   
   Stanley Daniel de Liver to mbATmbednarek.com@blackholespam.net   
   Re: unzip ,rename and zip it back using    
   05 Apr 14 20:02:03   
   
   From: admin@127.0.0.1   
      
   On Fri, 04 Apr 2014 13:35:58 +0100, Michael Bednarek   
    wrote:   
      
   > On Thu, 3 Apr 2014 22:06:06 -0700 (PDT), sekharece@gmail.com wrote in   
   > alt.msdos.batch:   
   >   
   >> I need help in creating a bat file that enables me to the following   
   >> automatically.   
   >>   
   >> I have a ZIp file by name abc.zip and it contains   
   >> files-test.txt,dec.drl,tes.txt .What i need is that first it needs to   
   >> unzip the file and then rename file names to parent zip file like   
   >> abc.txt,abc.drl,abc.txt. and then finally it need to zip it back.   
   >>   
   >> Any inputs are highly appreciated.   
   >>   
   >> Thanks in advance.   
   >>   
   >> Best Regards, Sekhar   
   >   
   > There's a flaw in your setup: you can't rename files-test.txt *and*   
   > tes.txt both to abc.txt. I'm going to assume the the latter is named   
   > tes.tes.   
   >   
   > Take a look ot the output of "help for". It shows a number of mechanisms   
   > to extract parts of file names. In your case, %~xI is useful. Something   
   > like this might work:   
   >   MD Working   
   >   Move abc.zip Working   
   >   CD Working   
   >   Unzip abc.zip   
   >   DEL abc.zip   
   >   FOR %%f IN (*.*) DO REN %%f abc%%~xf   
   >   Zip abc.zip *.*   
   >   Move abc.zip ..\   
   >   Del abc.*   
   >   CD ..   
   >   RD Working   
   > where Unzip and Zip have to be replaced by your local program.   
   >   
      
   rezip abc   
      
   rezip:   
      
   md %1   
   cd %1   
   unzip ..\%1.zip   
   ren *.* %1.*   
   cd ..   
   del %1.zip   (or zip with replace)   
   zip %1.zip %1\*.*   
   del %1\%1.*   
   rd %1   
      
      
   I hope we get a moderate grade for this.   
      
   --   
   It's a money /life balance.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca