Computing.Net > Forums > Programming > batch unzip

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch unzip

Reply to Message Icon

Name: tcdrake
Date: March 7, 2008 at 12:50:07 Pacific
OS: Windows 2000 server
CPU/Ram: Intel
Product: Dell
Comment:

I have received some help from another forum but am running into a time crunch so I am asking for help from here to. Here is what I am trying to do.

I get 85 zip files everyday in one directory. The zip files are named yyyymmdd-(location code).zip. Location code is 1 through 85. The folder I need to unzip them into does not match the location code it is another name. So location 1 maps to 090909 location 2 maps to 9809876 and so on. I have an excel sheet which has both location codes. Column 1 is location codes 1-85 and column 2 is the location codes they are mapped to. Below is what I have so far but it doesn't work.

for /f "tokens=1,2,3 delims=-" %%A in ('dir /b *.zip') do "c:\program files\winzip\wzunzip.exe" -e -s %%A%-%B.%%C c:\test\%B\

The output I get is...

C:\test>"c:\program files\winzip\wzunzip.exe" -e -s 20080123B. c:\test\B\

As you can tell the zip file name is wrong. It should be 20080123-30.zip because that is the file in the directory. It also looks like the .ZIP extension is not showing up in the file name. Plus I need to make sure that each zip is extracted to the right folder under c:\test\.
I’m guessing I need to look at an input file to get the correct folder like I mentioned earlier in this post.

Any help would be appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: BlueMan
Date: March 7, 2008 at 16:40:56 Pacific
Reply:

Did my answer come? I don't see it displayed.


0

Response Number 2
Name: Mechanix2Go
Date: March 8, 2008 at 11:04:10 Pacific
Reply:

@echo off
setLocal EnableDelayedExpansion

for /f "tokens=1-2 delims=.-" %%A in ('dir /b *.zip') do (
echo unzip -e -s "%%A-%%B.zip" "c:\test\%%B\"
)


=====================================
If at first you don't succeed, you're about average.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Cant get it to stop showi... Inheritance not working a...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch unzip

Setup prog or batch file www.computing.net/answers/programming/setup-prog-or-batch-file/125.html

batch to read a typed filename and www.computing.net/answers/programming/batch-to-read-a-typed-filename-and-/9196.html

Pls Help - Batch File www.computing.net/answers/programming/pls-help-batch-file/12167.html