Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I unzip all files in a folder using 7-zip in batch?

Tags:

batch-file

The title kind of says it all. I'm not sure how to do this, and the other post at Unzip all files in a folder using 7zip in CMD line

explains nothing to me very coherently. Could someone please help me with a simple way of unzipping all .zip files inside a specific folder?

like image 336
Seanzies93 Avatar asked Jul 16 '15 17:07

Seanzies93


2 Answers

This will unzip all zip files in the current folder(into the same folder), assuming you have installed 7zip into C:\Program Files\7-Zip location.

If you have added your 7zip folder into the path, you can just enter 7z instead of the fullpath

"C:\Program Files\7-Zip\7z.exe" e *.zip
like image 131
Gabor Avatar answered Sep 20 '22 09:09

Gabor


Just to add up on Gabor's answer. My default installation folder was C:\Program Files (x86)\7-Zip so I'm going to go from there. Here is the link to download 7zip.

I wanted to unzip every zip file in a directory into multiple folder. however the e in the previous answer export everything in the directory.

Here is for the "normal" unzip creating a folder per zip file unzipped:

 "C:\Program Files (x86)\7-Zip\7z.exe" x *.zip

And to have a full details of what you can do with 7z.exe use the --help:

 "C:\Program Files (x86)\7-Zip\7z.exe" --help

Here is its output:

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  b: Benchmark
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths

<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -ssw: compress shared files
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries
like image 30
Sylhare Avatar answered Sep 18 '22 09:09

Sylhare