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,924 of 42,547   
   Michael Bednarek to sekharece@gmail.com   
   Re: unzip ,rename and zip it back using    
   04 Apr 14 22:35:58   
   
   From: mbATmbednarek.com@BLACKHOLESPAM.NET   
      
   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.tx   
   ,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.   
      
   --   
   Michael Bednarek                           "ONWARD"   
      
   --- 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