Just Code‎ > ‎

DOS PROMPT - Command line to Use 7zip to compress all folders to individual archives

posted Nov 17, 2012, 2:37 PM by Peter Henell   [ updated Nov 17, 2012, 2:38 PM ]
This script will compress each folder, using maximum compression rate and the 7zip compression type. Each folder will be compressed into one archive file each. No files are deleted or modified during the process unless the .7z files already exists.


If you have added 7zip directory to your PATH you can use this:

for /d %%X in (*) do 7z a -t7z -mx9 "%%X.7z" "%%X\"

If not, then you need to change this so that the path points to your installation path of 7zip

for /d %%X in (*) do "C:\Program Files\7-Zip\7z.exe" a -t7z -mx9 "%%X.7z" "%%X\"
Comments