How to Use 7Zip to Compress Many Folders into Individual Zipped Files

Do you have a folder packed with folders? And you want to compress all the folders into individual zip files? Here’s the solution.

This script will take the following directory structure:

>Top Folder
>>Sub-Folder1
>>Sub-Folder2
>>>>File in Sub-Folder2-1
>>>>File in Sub-Folder2-2

And it will create zipped folders that respect the inner sub-folder structure. It will also unpack perfectly using the Windows Compressed utility on Windows Server and Windows XP/7/8

>Top Folder
>>Sub-Folder1.zip
>>Sub-Folder2.zip

How to Compress Multiple Folders into Individual Zip Files

  1. Download the 7Zip Standalone program at 7Zip’s website. There’s no need to install it, so it’s perfect for servers.
  2. Extract it to your C: drive into a 7Zip folder. The path to your exe file should be C:7Zip7za.exe.
  3. Open Notepad and paste the following line of code into it:
    for /D %%A in (*) do “C:7Zip7za.exe” a -tzip -mx=5 “%%A.zip” -xr!*.bat -xr!*.zip “%%A”
  4. Save the Notepad document as zipALLfolders.bat file and be sure to select “All Files” in the drop down.
  5. Put the zipALLfolders.bat wherever you want to zip your folders.
  6. Run it. Done. The BAT file will skip any ZIP or BAT files inside the main directory, btw.
Advertisements