batch-file7zip

extracting multiple files with 7zip & creating a folder for each


I have like 300 zip files (but may get other kind of archives in the future) in a folder and I need to unzip each one in a subfolder of the archive name.

I've tried native 7zip options in command line but nothing worked yet, did not get any luck in the 7zip FAQ either. Finally tried "forfiles" in batch and that seemed to provide better results, but cannot manage to get it working.

Here is the last thing I tried :

forfiles /m *.zip /c "C:\tool\7-Zip\7z.exe e -o@path @file"

But cannot manage to get any result, this is what I get with a 4 zip sample:

C:\Users\tracto\test>forfiles /m *.zip /c "C:\tool\7-Zip\7z.exe e -o@path @file"

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Error:
Incorrect command line

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Error:
Incorrect command line

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Error:
Incorrect command line

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Error:
Incorrect command line

I'll take any help you can offer, thx in advance.


Solution

  • There is a built in command for this in 7zip.

    This command line will extract all zip files in the current directory (e *.zip) to directories with names of archives (-o*).

     C:\tool\7-Zip\7z.exe e "*.zip" -o*