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?
 
Bill PrewCommented:
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
 
Bill PrewCommented:
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 PrewCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.