1

I have a large directory of zip files, each containing a single file. I would like to extract all the zip files automatically, into one directory.

7-zip has a feature to extract multiple zips into the same directory. However, it creates a sub-directory for each original zip. Here is what the before and after look like:

Before:

- before
  - a.zip
    - a.txt
  - b.zip
    - b.txt
  - c.zip
    - c.txt
  - d.zip
    - d.txt

After:

- after
  - a
    - a.txt
  - b
    - b.txt
  - c
    - c.txt
  - d
    - d.txt

However, my desired output is this:

- after
  - a.txt
  - b.txt
  - c.txt
  - d.txt

How can I do this?

1

If you select all the zip files in Explorer and right-click, you should find an option Extract Here under the 7-Zip menu. This should do what you want.

0

You can try using a batch file for this task. Something like:

::Path where zip files are stored
SET SOURCEPATH=C:\zips\before

::Target Path where extracted files will be stored
SET TARGETPATH=C:\zips\after

::path to 7-zip
SET Z=C:\Program Files\7-Zip\7z.exe

::Extract each file in source folder into target
FOR %%f in (%SOURCEPATH%\*.zip) do "%Z%" e %%f -o%TARGETPATH%

This batch file will unzip all files in the "Before" folder with the "zip" extension into the "After" folder. You must modify the source, target, and 7zip paths.

0

You can do this on the command line with the "e" switch.

7za e archive.zip -o\\path\to\target

The -o switch is optional, and lets you specify a target directory for unpacking. Don't put a space between the -o and the path. If you don't specify it, the current directory will be used.

Just be careful that your archive doesn't have files with the same name in different folders.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.