Extracting a zip file to its own folder
Extracting a zip file to its own folder
Hi all. I'm a new XY user trying to meld XY into my subconscious like I have with Windows Explorer.
Something I do a lot is extract compressed archive files (mostly zips) to their own folder.
Like extract the contents of "my.zip" to a new folder named "my".
There's an option to do this very thing right in XYPlorer: right-click, then "Zip" then "Extract to <my>\"
But there doesn't seem to be a keyboard shortcut for that. I tried to make a new kbd shortcut but couldn't find this action. Where's it at?
(I also found an add on script called Extractor posted herebut I'm hoping to learn how find these actions.
Something I do a lot is extract compressed archive files (mostly zips) to their own folder.
Like extract the contents of "my.zip" to a new folder named "my".
There's an option to do this very thing right in XYPlorer: right-click, then "Zip" then "Extract to <my>\"
But there doesn't seem to be a keyboard shortcut for that. I tried to make a new kbd shortcut but couldn't find this action. Where's it at?
(I also found an add on script called Extractor posted herebut I'm hoping to learn how find these actions.
Re: Extracting a zip file to its own folder
There isn't any "zip to" action that can be bound to a keyboard shortcut. Not every single context menu command is available as such but it can be scripted...
One of my scripts helped you out? Please donate via Paypal
Re: Extracting a zip file to its own folder
Best way to go about this is write a script.
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial
Re: Extracting a zip file to its own folder
Advantage: Works for all selected files, not only a single one...
Code: Select all
foreach($item, get("SelectedItemsPathNames", "|"), "|") {
if ($item != "" && getpathcomponent($item, "ext") == "zip") {
zip_extract($item, getpathcomponent($item, "base"), , "|");
}
}
status "Extraction of archive(s) completed...", "00800000", "ready";
One of my scripts helped you out? Please donate via Paypal
Re: Extracting a zip file to its own folder
Highend, that sounds perfect.
Can someone help me understand the script a bit?
So we'll be looping through each selected file and in each iteration of the loop $item will refer to a different selected file.
If the file's extension is "zip", stuff happens, otherwise it's skipped.
Is this case insensitive?
This is the interesting one.
Looks like the call for the zip_extract function is:
zip_extract(zipfile, path, [itemlist], [separator="|"])
Why the pipe as the 4th param? Is it possible getpathcomponent($item, "base") could return multiple files? What could cause that? And why would they be pipe separated?
Thanks so much for the replies everyone :-)
Can someone help me understand the script a bit?
Code: Select all
foreach($item, get("SelectedItemsPathNames", "|"), "|") {
Code: Select all
if ($item != "" && getpathcomponent($item, "ext") == "zip") {
Is this case insensitive?
Code: Select all
zip_extract($item, getpathcomponent($item, "base"), , "|");
Looks like the call for the zip_extract function is:
zip_extract(zipfile, path, [itemlist], [separator="|"])
Why the pipe as the 4th param? Is it possible getpathcomponent($item, "base") could return multiple files? What could cause that? And why would they be pipe separated?
Thanks so much for the replies everyone :-)
Re: Extracting a zip file to its own folder
YesIs this case insensitive?
To separate items in the itemlist.Why the pipe as the 4th param?
No, but why should it? There is a while | foreach loop to do such things.Is it possible getpathcomponent($item, "base") could return multiple files?
Never thought of it...What could cause that? And why would they be pipe separated?
One of my scripts helped you out? Please donate via Paypal
Re: Extracting a zip file to its own folder
The pipe character isn't accepted as a valid file name and hence it becomes a good choice as a delimeter.
Re: Extracting a zip file to its own folder
Is it possible to extract a single file from a zip file ? I love XY has built in compressor, as I migrate XY to be my one stop program for file managing and much more.
Re: Extracting a zip file to its own folder
rtfm "idh_scripting_comref.htm#idh_sc_zip_extract";
One of my scripts helped you out? Please donate via Paypal
Re: Extracting a zip file to its own folder
FYI, I read the manual, not the scripting portion. I loaded the command in the address bar, nothing happenshighend wrote:rtfm "idh_scripting_comref.htm#idh_sc_zip_extract";
Re: Extracting a zip file to its own folder
I added two colons at the start, now paste this into the AB and hit enter.
Code: Select all
::rtfm "idh_scripting_comref.htm#idh_sc_zip_extract";
Ralph
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
Re: Extracting a zip file to its own folder
Too many languages and keyboard short-cuts for programs I use; XY is always last to rememberRalphM wrote:I added two colons at the start, now paste this into the AB and hit enter.Code: Select all
::rtfm "idh_scripting_comref.htm#idh_sc_zip_extract";
Re: Extracting a zip file to its own folder
Code: Select all
text zip_extract("<network drive>\<folder>\<zipfile>","<folder>","<specific file I only want extracted>");
Re: Extracting a zip file to its own folder
Sorry, but the way you posted it, it can't work. (These <...> that you used are just not recognized by XY. I dunno how you came up with that.)
The last example in the help file should be exactly what you want, I think, and it works, at least on my machine.
The last example in the help file should be exactly what you want, I think, and it works, at least on my machine.
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
Re: Extracting a zip file to its own folder
@CookieMonster: Do you have write access to the target path? (I ask because apparently it's a net path)
Try extracting to a local path.
@autocart: I'm pretty sure CM used those <terms> as placeholders in the post only, and not in the script.
Try extracting to a local path.
@autocart: I'm pretty sure CM used those <terms> as placeholders in the post only, and not in the script.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]