8

There are many ways to unzip archives on Unix:

The goal is to find all archives and uncompress them in their own directory (where each archive is found) on Windows.
Optional:

  • remove the archive after unzip.
  • record any error message if one archive has any issue during unzip.

I am looking for a plain DOS command line, using, for instance, 7z.exe (which is included in the portable version of PeaZip).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

2 Answers2

8

I took a command-line from this thread of the sevenzip project, with a small modification:

FOR /R %I IN (*src.zip) DO (C:\apps\peazip_portable-3.8.WINDOWS\res\7z\7z.exe x "%I" -aoa -o"%~dpI\*" |c:\windows\system32\find.exe "Everything is Ok" >nul  &&DEL /F "%I" ||ECHO.%I : EXTRACT FAIL - ARC NOT DELETED >>ERR.TXT)

(multi-line for visibility)

FOR /R %I IN (*src.zip) DO ( \
  C:\apps\peazip_portable-3.8.WINDOWS\res\7z\7z.exe x "%I" -aoa -o"%~dpI\*" 
  |c:\windows\system32\find.exe "Everything is Ok" >nul &&DEL /F "%I"
  ||ECHO.%I : EXTRACT FAIL - ARC NOT DELETED >>ERR.TXT)

Notes:

  • I prefer specifying "c:\windows\system32\find.exe" instead of just FIND, because I have other 'find.exe' on my PATH (from msysgit, or gow).
  • remove the '&&DEL /F "%I"' part if you want to keep the archives in place.

I just unzipped 470 "src.zip" from the Rational Team Concert SDK in two minutes with that one-liner!

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

This is an old question, but somebody may find this useful. This method worked for me using WinZip and the WinZip Command Line add-on, both available on the WinZip site for registered users.

FOR /R %I IN (*.zip) DO (C:\Program Files (x86)\winzip\wzunzip.exe -ye "%I" "%~pI")

-ye will name the folder after zip filename. %I is the zip file name %~pI is the zip file contents destination

Feel free to add the debugging messages in the previous answer. Run the command inside the folder where all your subfolders containing your zip files are stored.

BasicIsaac
  • 187
  • 8