Way to compress folders individually using 7zip on a large collection of folders

7-zipbatchcompression

How can 260 folders be zipped individually using 7zip with a single command?

The person who originally asked this question voluntarily deleted the post. Since it was an interesting task, I resurrected the question and developed a solution, which is posted below as an answer.

Best Answer

This works for files not sub-folder in a parent folder http://dropcanvas.com/w7u6a/3

http://dropcanvas.com/w7u6a/3

@echo off
cd /d %~dp0
rem 7z.exe path
set sevenzip=
if "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exe
if "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exe
if "%sevenzip%"=="" echo 7-zip not found&pause&exit
set extension=.mp4
for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a"
pause
[/CODE]
Related Question