how to archive multiple selected items using 7-zip

Discuss and share scripts and script files...
Post Reply
Huidong
Posts: 213
Joined: 18 May 2011 21:55

how to archive multiple selected items using 7-zip

Post 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>"

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

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

Post by zer0 »

7zip takes space-separated list of items, so try using <selitems>, though you may need to strip quotes from the content.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

Huidong
Posts: 213
Joined: 18 May 2011 21:55

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

Post 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>

Post Reply