Page 1 of 1

Extract only one type of file from zip file

Posted: 02 Dec 2018, 13:40
by shipaddicted
I frequently download zip files that contain maybe 40 different folders inside, each containing several different file types of the same graphic. I only need to extract the .Svg files out - the rest is garbage to me (.Jpg, .Ai, .dxf, etc.), even the parent folders. How can I do this with AutoHotKey? ?

I have tried to figure this out via poking through the menus on the 7zip software, with no luck. If I just try to select via file type, it still extracts every single file, so I still have to go through the folders 1x1 and pull out what I need and delete the rest. I have read on the 7zip forums that this could be done with the command line, but nobody provides step-by-step instructions, just the formula for the end result and I haven't figured out how to read their formula so I can substitute what I need. And even if I did it this way, I would still likely want to do it via ahk. Can anyone help?

Thanks!

Re: Extract only one type of file from zip file

Posted: 02 Dec 2018, 14:32
by oif2003
Does this work?
"C:\Program Files\7-Zip\7z.exe" e test3.7z *.exe -r

Where *.exe is the filter
and test3.7z is the 7z file

Re: Extract only one type of file from zip file

Posted: 02 Dec 2018, 15:16
by shipaddicted
I'm looking for .svg files - I'm not following how this would extract those. Would I substitute *.exe with *.svg ??

Thanks!

Re: Extract only one type of file from zip file

Posted: 02 Dec 2018, 15:30
by oif2003
Yup! swap *.exe for *.svg
then try to execute this from AHK using "run"

You can also specify output folder using -o
ie: "C:\Program Files\7-Zip\7z.exe" e test3.7z -o outputdir *.exe -r

from: https://superuser.com/questions/321829/ ... ine#683817

Re: Extract only one type of file from zip file

Posted: 02 Dec 2018, 15:55
by shipaddicted
Run "C:\Program Files\7-Zip\7z.exe" e "C:\Users\Paige\Downloads\BF_2018-09-06.zip" -o "C:\Users\Paige\Desktop\Silhouettetemp\" *.svg -r

I have tried several variations of this with no luck (changing which paths are put into quotes ). If it's working, I don't know where they're being extracted to -- but I do know it's not to my silhouette temp folder on my desktop! ;)

I'm sure I've screwed up the syntax somewhere -- can you nudge me a little further in the right direction? Thanks!

Re: Extract only one type of file from zip file

Posted: 02 Dec 2018, 16:13
by oif2003
What I told you earlier was not correct.... sorry about that.

I checked out the --help and came up with this that worked on my computer:
Run, "C:\Program Files\7-Zip\7z.exe" e -o"C:\Users\Name\Desktop\testfolder" "C:\Users\Name\Desktop\test3.7z" *.exe -r

Notice how -o follows e, and there is no space between -o and the directory path.
You can add -y to suppress overwrite prompt.
ie: Run, "C:\Program Files\7-Zip\7z.exe" e -y -o"C:\Users\Name\Desktop\testfolder" "C:\Users\Name\Desktop\test3.7z" *.exe -r

for more info: http://7zip.bugaco.com/7zip/MANUAL/swit ... ut_dir.htm

Re: Extract only one type of file from zip file

Posted: 03 Dec 2018, 22:58
by shipaddicted
I still haven't had any luck, but now I have a cold, so my brain is a mess. I can't concentrate when I'm all drugged up. I'll have to shelve this for a couple of days. BRB.

Re: Extract only one type of file from zip file

Posted: 05 Dec 2018, 22:42
by itssherylle1989
I used 7downloads to download zip app for my files it's really past. 7zip has a guide you can review here: https://7zipguides.com/.