Page 1 of 1

how to archive multiple selected items using 7-zip

Posted: 19 May 2011 09:37
by Huidong
I wrote a command line to archive last-selected item (either a folder or a file) using 7-zip, but I don't know how to archive multiple selected items. Could you help, please? Thanks!

Code: Select all

"Archive last selected"
  run "C:\Program Files\7-Zip\7z.exe" "a" "-t7z" "<curbase>.7z" "<curitem>"

Re: how to archive multiple selected items using 7-zip

Posted: 19 May 2011 11:45
by zer0
7zip takes space-separated list of items, so try using <selitems>, though you may need to strip quotes from the content.

Re: how to archive multiple selected items using 7-zip

Posted: 19 May 2011 11:57
by Huidong
zer0 wrote:7zip takes space-separated list of items, so try using <selitems>, though you may need to strip quotes from the content.
Wonderful hint! Strip quotes! Thanks a lot, zer0!
The following then works as desired:

Code: Select all

"Archive all selected to 7z with their parent folder name"
  run "C:\Program Files\7-Zip\7z.exe" "a" "-t7z" "<curfolder>.7z" <selitems>