Extracting a Zip file to a folder via CTB
-
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Extracting a Zip file to a folder via CTB
Have been very pleased since Zips were incorporated natively into XY.
An operation that occurs with great frequency here is to extract a Zip file's contents to a folder with that name. Now Command #280 "Extract here" is provided. However, that just dumps the files into the same folder.
Can a script be written that can be placed into a CTB that will take the selected Zip, create a folder with the same name and then put the extracted files in there?
An operation that occurs with great frequency here is to extract a Zip file's contents to a folder with that name. Now Command #280 "Extract here" is provided. However, that just dumps the files into the same folder.
Can a script be written that can be placed into a CTB that will take the selected Zip, create a folder with the same name and then put the extracted files in there?
Re: Extracting a Zip file to a folder via CTB
Am I missing something? Doesn't work here. Neither on portable nor on install?aurumdigitus wrote:Have been very pleased since Zips were incorporated natively into XY.
-
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Re: Extracting a Zip file to a folder via CTB
Maybe wrong nomenclature?
Try this: Right click a file with Zip extension, slide down for lines to zip, the menu opens.
Try this: Right click a file with Zip extension, slide down for lines to zip, the menu opens.
- Attachments
-
- Zip menu.jpg (89.08 KiB) Viewed 3224 times
Re: Extracting a Zip file to a folder via CTB
You may want to give highend's very nice "Extractor" a try. It will unzip the current file into a new folder with the name of the zip file. It's a button on my toolbar. http://www.xyplorer.com/xyfc/viewtopic. ... lit=autoit
There's an option to delete the file after extraction or keep it as well. It uses AHK but he has provided a compiled version and it will utilize the extractor of your choice.
There's an option to delete the file after extraction or keep it as well. It uses AHK but he has provided a compiled version and it will utilize the extractor of your choice.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440
Re: Extracting a Zip file to a folder via CTB
Throws an error - which does not surprise me since I am on XP right now, but even my Win7 systems override the (really bad) Win zippers with tools that XY does not recognize.aurumdigitus wrote:Right click a file with Zip extension, slide down for lines to zip, the menu opens.
I guess we have a very different interpretation of what you call "incorporated natively into XY"
I did. Definitely an improvement. But still a far cry from the native support in other managers (my main reason for still using them).klownboy wrote:You may want to give highend's very nice "Extractor" a try.
-
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Re: Extracting a Zip file to a folder via CTB
Must be that Zipping like beauty is in the eye of the beholder. Thus far - except for the query that initiated the thread - XY has been able to handle all my compression/decompression needs.I guess we have a very different interpretation of what you call "incorporated natively into XY"
Re: Extracting a Zip file to a folder via CTB
Again - it's 3rd party that handles it. I didn't mean to question your taste , you made me question my workflow - if maybe I had overlooked something.aurumdigitus wrote:XY has been able to handle all my compression/decompression needs.
Zipping is a function in my eyes. You'll drop your "beauty" the very instant XY tempts you with native support in list view. Bet on it. It's all about efficiency and comfort - not about loyalty to an old way of doing things.
Until then, I think highend's script will do exactly what you asked for.
-
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Re: Extracting a Zip file to a folder via CTB
Coding and scripting are largely outside my sphere of cognition. What XY is doing with Zips appears to be transparent - however Don pulls it off.Again - it's 3rd party that handles it. I didn't mean to question your taste
Anyway, as no one has come forward with a custom XYS will examine highend's Extractor as has been suggested.
Re: Extracting a Zip file to a folder via CTB
No idea where I found this, but I've got the following set up for handling zip files:
EDIT: Added screenshot
HTH
Cheers,
Michael
Code: Select all
"_Initialize";
perm $p_zip = "C:\Program Files\7-Zip\7zG.exe";
perm $p_Zip = "C:\Program Files\7-Zip\7zFM.exe";
"just a message on winmount" msg "will NOT work on Winmount scripted created 7z files. <br> 7z created in the GUI will work. "
"&Open <curname> : open"
openwith "$p_Zip";
-
"&List all this folder "
selfilter "*.rar ; *.7z ; *.cab ; *.gz ; *.zip";
$SelectedItems = get("SelectedItemsNames", "|");
foreach($Item, $SelectedItems, "|") {
rename s, " /";
}
wait 500;
selfilter "*.rar ; *.7z ; *.cab ; *.gz ; *.zip";
$SelectedItems = get("SelectedItemsNames", "|");
foreach($Item, $SelectedItems, "|") {
Run("cmd /c $p_zip l $Item >> <curfolder>.txt");
wait 500;
}
"List <curname> single"
rename s, " /";
Run("cmd /c $p_zip l <curitem> > <curitem>.txt");
-
"7-Zip and move. (<curbase>.&7z and move) : 7z"
focus;
#113;
focus;
$curbase= <clipboard>;
$l = strlen ($curbase);
$p = strpos ($curbase, <crlf>);
$curbase = regexreplace ($curbase, "^-1$", "$l");
if ($p = "-1") { $p = $l ; }
$curbase = substr ($curbase, 0, $p);
$curbase = replace ($curbase," ","_");
set $curbase, "$curbase.7z";
//Compress file with .zip. Name= base of file.
$a = get("path", i);
openwith """$p_zip"" a -t7z $a\$curbase";
-
"Convert into <curbase>.&zip : zip"
focus;
#113;
focus;
$curbase= <clipboard>;
$l = strlen ($curbase);
$p = strpos ($curbase, <crlf>);
$curbase = regexreplace ($curbase, "^-1$", "$l");
if ($p = "-1") { $p = $l ; }
$curbase = substr ($curbase, 0, $p);
$curbase = replace ($curbase," ","_");
set $curbase, "$curbase.zip";
//Compress file with .zip. Name= base of file.
openwith """$p_zip"" a -tzip $curbase" ;
"Convert into <curbase>.&7z : 7z"
focus;
#113;
focus;
$curbase= <clipboard>;
$l = strlen ($curbase);
$p = strpos ($curbase, <crlf>);
$curbase = regexreplace ($curbase, "^-1$", "$l");
if ($p = "-1") { $p = $l ; }
$curbase = substr ($curbase, 0, $p);
$curbase = replace ($curbase," ","_");
set $curbase, "$curbase.7z";
//Compress file with .zip. Name= base of file.
openwith """$p_zip"" a -t7z $curbase"
-
"&Extract contents of <curname> here : ext"
//Extract content to folder Name= base of zip. aot= If files exist, autonumber new files.
openwith """$p_zip"" x -aot"
"&Extract contents of <curname> to folder <curbase> : extf"
openwith """$p_zip"" x -y -o* -aot <items>"
"&Extract contents of <curname> to other pane w renumber existing : extfop"
$a = get("path", i);
openwith """$p_zip"" x -y -o$a -aot <items>" ;
"&Extract contents of <curname> to other pane : extfopr"
$a = get("path", i);
openwith """$p_zip"" x -y -o$a <items>" ;
"&Extract contents of <curname> to <curbase> other pane : extfopra"
$a = get("path", i);
openwith """$p_zip"" x -y -o$a\<curbase>\ <items>" ;
"&Extract contents of <curname> to other pane w renumber archive file : extfopr"
$a = get("path", i);
openwith """$p_zip"" x -y -o$a -aou <items>" ;
"&Extract contents of <curname> to <curbase> other pane w renumber archive file : extfopra"
$a = get("path", i);
openwith """$p_zip"" x -y -o$a\<curbase>\ -aou <items>" ;
-
"Convert into <curbase>.zi&p (password protection) : pzip"
focus;
#113;
focus;
$curbase= <clipboard>;
$l = strlen ($curbase);
$p = strpos ($curbase, <crlf>);
$curbase = regexreplace ($curbase, "^-1$", "$l");
if ($p = "-1") { $p = $l ; }
$curbase = substr ($curbase, 0, $p);
$curbase = replace ($curbase," ","_");
set $curbase, "$curbase.zip";
$i = input (Input password for zipfile, password);
//Compress with .zip and password protect archive.
openwith """$p_zip"" a -tzip $curbase -p$i"
"Convert into <curbase>.7z (password protection) : p7z"
focus;
#113;
focus;
$curbase= <clipboard>;
$l = strlen ($curbase);
$p = strpos ($curbase, <crlf>);
$curbase = regexreplace ($curbase, "^-1$", "$l");
if ($p = "-1") { $p = $l ; }
$curbase = substr ($curbase, 0, $p);
$curbase = replace ($curbase," ","_");
set $curbase, "$curbase.7z";
$i = input (Input password for zipfile, password);
//Compress with 7z and password protect and encrypt archive headers.
openwith """$p_zip"" a -t7z $curbase -p$i -mhe"
"?Set Password to <curname> : zp"
global ($p_zip);
set $file, <curbase>;
openwith """$p_zip"" e -aou";
msg "wait until extract",1;
focus;
filter $file*;
delete 0,0;
sortby created, d;
sel 1;
sub pzip;
filter
"?Set Password to <curname> : z7"
global ($p_zip);
set $file, <curbase>;
openwith """$p_zip"" e -aou";
msg "wait until extract",1;
focus;
filter $file*;
delete 0,0;
sortby created, d;
sel 1;
sub p7z;
filter
-
"Edit script : edit"
$ScriptFile = self ("file");
run "$p_note" $ScriptFile,w;
-
"Cancel"
"_Terminate";
unset $p_zip;
unset $p_Zip;
EDIT: Added screenshot
HTH
Cheers,
Michael
Last edited by mkolaski on 03 Jul 2014 17:17, edited 1 time in total.
Re: Extracting a Zip file to a folder via CTB
Your request: "...a CTB that will take the selected Zip, create a folder with the same name and then put the extracted files in there?"aurumdigitus wrote: Anyway, as no one has come forward with a custom XYS ...
klownboy's answer (about Extractor): "It will unzip the current file into a new folder with the name of the zip file."
How can code behind the scenes - that you don't see - be transparent? In comparison to script code that you can read line by line? Not that you have to, though. Extractor will ask you for the location for your zipper software if it can't find it.aurumdigitus wrote:What XY is doing with Zips appears to be transparent
Be aware, however, that this setting is not necessarily portable But that's not different from the way XY handles your zippers now - if it can't find the expected zipper on a system, it won't work.
-
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Re: Extracting a Zip file to a folder via CTB
@ Stef123 - By Transparent meaning that nothing else had to do done on this end. If XY is doing its Zip thing by invoking some other software on the machine that is beyond my understanding.
Extractor seems to be a separate program that needs one of its required Zip utilizes to operate. Seems rather convoluted as opposed to staying within XY.
But then coding is not chemistry (which is my vocation).
Extractor seems to be a separate program that needs one of its required Zip utilizes to operate. Seems rather convoluted as opposed to staying within XY.
But then coding is not chemistry (which is my vocation).
-
- Site Admin
- Posts: 60602
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Extracting a Zip file to a folder via CTB
Thanks Michael, interesting stuff! One day I will have time for this...mkolaski wrote:No idea where I found this, but I've got the following set up for handling zip files...
FAQ | XY News RSS | XY Twitter
Re: Extracting a Zip file to a folder via CTB
Maybe i'm missing something, but the original question was:
Put a new user button onto the toolbar and paste the "zip_extract();" command into the "On left click:" box. Done. The selected zip file will be extracted into a subfolder with the zip files name.
(Of course, there is no error handling done. So you'll get script errors if an invalid file (no zip) is selected)
That's a simple script command:aurumdigitus wrote:Can a script be written that can be placed into a CTB that will take the selected Zip, create a folder with the same name and then put the extracted files in there?
Code: Select all
zip_extract();
(Of course, there is no error handling done. So you'll get script errors if an invalid file (no zip) is selected)
-
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Re: Extracting a Zip file to a folder via CTB
Yes, yes Pagat - that is it! Exactly what was desired. You are a sagacious individual.
Reminds me of a quotation by Charles Darwin: To see what every man has seen; to think what no man has thought.
zip_extract(); The distilled essence of simplicity. One word, fourteen characters.
Reminds me of a quotation by Charles Darwin: To see what every man has seen; to think what no man has thought.
zip_extract(); The distilled essence of simplicity. One word, fourteen characters.
Re: Extracting a Zip file to a folder via CTB
Bull's eye - right on target.aurumdigitus wrote:Yes, yes Pagat - that is it! ... The distilled essence of simplicity
Distillation - an apt wording. So you're in chemistry, huh? I am impressed. Nothing more taxing than those formulas. Watching the teacher juggle flasks and vials fascinated me. But I never grasped the theory behind those cocktails - way over my head.
@ Michael
Quite some dropdown - won't help my situation (I extract small subsets only, need to get a preview instead of dumping thousands of files on disk every time) - but I can imagine this script being a great starting point to adapt and tweak to personal preference.