compress mulitple folders into multiple zip files

973 views
Skip to first unread message

Nicolas Caplat

unread,
May 20, 2022, 9:12:50 AM5/20/22
to OneCommander
Hello,

Using files automation, I'd like to be able to select a bunch of folders, and compress them individual zip archives (one zip file per folder) using 7zip. I guess that would rely on some script, but I really have no idea about how to do that ... any help would be greatly appreciated !

Thanks in advance :)

Best regards.

Nicolas Caplat

Milos Paripovic

unread,
May 20, 2022, 10:18:11 PM5/20/22
to OneCommander
I rarely use any command-line scripting so I wouldn't be able to help, but if nobody here can help, asking a question on Stackoverlow or other forums that deal with command line or powershell could be a good place to ask. OC just runs command for each selected item individually so if you find a command that can do it for one it can apply it to multiple - and this works with new scripts features from Settings>Experimental so you wouldn't need to even use Automator
Message has been deleted

Nicolas Caplat

unread,
May 24, 2022, 5:39:04 AM5/24/22
to OneCommander
Oh, finally got a .bat file to work ... simply: 
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.7z" "%%X\"

Now, how can I use this directly in OC / File Automator; please ?



Le mardi 24 mai 2022 à 11:24:39 UTC+2, Nicolas Caplat a écrit :
Hello :)

How should I do to do that with OC File Automator please ? 

Thanks in advance,

Regards.

Milos Paripovic

unread,
May 24, 2022, 11:41:41 AM5/24/22
to OneCommander
You can add this as it is as Scripts (new feature from Experimental settings tab)
but to use it from Automator I'll have to add option to take only name from selected file and not the full path

Nicolas Caplat

unread,
May 25, 2022, 3:53:50 AM5/25/22
to OneCommander
Good morning Milos,

Thanks for your answer. Using it as a script would be perfect ! even better than to open File Automator just for this ;)

Regards.

Nicolas Caplat

unread,
May 25, 2022, 3:59:47 AM5/25/22
to OneCommander
Ok, I've tried to put my script either with .txt or with .bat extension, it doesn't work. My script is displayed in the scripts list, I got the execution confirmation warning message, and then nothing happens ... any idea please ?

Thanks !

Milos Paripovic

unread,
May 29, 2022, 3:07:27 PM5/29/22
to OneCommander
When I tried to execute that in command line I've got the error on  %%X, but replacing all with %X worked.
Saving that as file in scripts also worked when invoked from the Scripts menu. 

In case you want to use File Automator I need to make a change and in 3.5.15 you will be able to select folders and run in automator something like 
"c:\Program Files\7-Zip\7z.exe" a "$SourceFileName.7z" "$SourceFile"

Reply all
Reply to author
Forward
0 new messages