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:
>>>>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
How to Compress Multiple Folders into Individual Zip Files
- Download the 7Zip Standalone program at 7Zip’s website. There’s no need to install it, so it’s perfect for servers.
- Extract it to your C: drive into a 7Zip folder. The path to your exe file should be C:7Zip7za.exe.
- 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”
- Save the Notepad document as zipALLfolders.bat file and be sure to select “All Files” in the drop down.
- Put the zipALLfolders.bat wherever you want to zip your folders.
- Run it. Done. The BAT file will skip any ZIP or BAT files inside the main directory, btw.