Peter Long
Peter Long

Reputation: 109

Using 7-zip to add folders to separate archive (windows)

With Winrar I can use this command for create archives for each folder

for folder in */; do rar a -m0 -r "${folder%/}.rar" "$folder"; done

I use windows and I want cloning this command using 7z Console because software is more strong.
I try also this batch

@ECHO OFF
FOR %%A IN (*) DO "c:\program files\7-zip\7z.exe" a -mx9 -m0=lzma2:d256m "%%~nA.7z" "%%A"

but archive me only files, not separated folders.

Upvotes: 4

Views: 8214

Answers (1)

Peter Long
Peter Long

Reputation: 109

Solution here

for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\"

Upvotes: 5

Related Questions