Winzip/Wzunzip batch file

Hello experts.


The following bactch file unziups folders in the "decrypted" directory, leaving behind the original zip file. All the zip files are actually folders that have ben zipped.

I need the batch to unzip these folders to c:\unzipped, without leaving the orignal behind in c:\decrypted.

Please help, thanks!

@echo off
set BaseDir=c:\decrypted
for /r "%BaseDir%" %%A in (*.zip) do (
  md "%%~dpnA"
  "C:\Program Files\WinZip\WZunZIP.EXE" -o "%%A" "%%~dpnA"
)
blastmasterJUS1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
See if this does what you need:

@echo off
set BaseDir=c:\decrypted
set DestDir=c:\unzipped
for /r "%BaseDir%" %%A in (*.zip) do (
  md "%DestDir%\%%~dpnA"
  "C:\Program Files\WinZip\WZunZIP.EXE" -o "%%A" "%DestDir%\%%~dpnA"
  del "%%A"
)

Open in new window

~bp
0
blastmasterJUS1Author Commented:
thanks Bill. This did unzip the files to c:\unzipped and did not leave copies in the originating folder however, what showed up in c:unzipped was a single folder called "C_", within that folder was another folder called "decrypted" and then underneath that were my original folders. I just need the original folders to end up in c:\unzipped.

For example, I have these 2 files in C:\decrypted, which are really folders containing other files.

20.zip
21.zip
22.zip

I need these folders\directories to be unzipped seperately to c:\unzipped. i.e.:

20
21
22

Thanks again!
0
Bill PrewIT / Software Engineering ConsultantCommented:
Can you either post one of the ZIP files here, or at least post the output of a wzunzip -v command against one of the files please.

~bp
0
blastmasterJUS1Author Commented:
Here you are. Thanks Bill.
21.zip
0
Bill PrewIT / Software Engineering ConsultantCommented:
Okay, sorry I didn't catch that sooner, this should correct that problem.

@echo off
set BaseDir=c:\decrypted
set DestDir=c:\unzipped
for /r "%BaseDir%" %%A in (*.zip) do (
  md "%DestDir%\%%~nA"
  "C:\Program Files\WinZip\WZunZIP.EXE" -o "%%A" "%DestDir%\%%~nA"
  del "%%A"
)

Open in new window

~bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.