Extracting a zip file to its own folder

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
CookieMonster

Re: Extracting a zip file to its own folder

Post by CookieMonster »

SammaySarkar wrote:@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. :)
Sammy - Yes I have write access to the target path on the network. I will try in the morning with a relative path.
Autocart - Sammay gave you the answer !

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: Extracting a zip file to its own folder

Post by autocart »

CookieMonster wrote:
SammaySarkar wrote:@autocart: I'm pretty sure CM used those <terms> as placeholders in the post only, and not in the script. :)
Autocart - Sammay gave you the answer !
Well, this way its much harder to give support, having to guess what might be wrong with that line of code.
If you are using a seperator in the files to be extracted list, is it a "|"?

EDIT: Rereading again, I might assume that you where using absolute paths for testing purposes. For some reason that did not come to me before, because I thought it would be clearly not done always typing out the path/filename. But for testing ... ok. Sorry.
Last edited by autocart on 04 Aug 2014 14:37, edited 1 time in total.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Extracting a zip file to its own folder

Post by highend »

Extracting specific files to a network path works perfectly fine with zip_extract() so it's simply a user error...
One of my scripts helped you out? Please donate via Paypal

CookieMonster

Re: Extracting a zip file to its own folder

Post by CookieMonster »

Code: Select all

text zip_extract("<absolute path to filename>.zip","<path to extract>","<file in zip 1>|<file in zip 2>");
Relative and Absolute paths don't work. This is what comes up when extracting two files in a zip file.

Image

Ruling out a user error is a great suggestion :appl: What error the user is doing is more specific :)

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Extracting a zip file to its own folder

Post by highend »

an image
I don't see any errors. I just see that you've tried to extract <some files> to a folder named "5"...

You want specific answers? Impossible without specific details...

Which ones?

1. Full path (and name) of the .zip file
2. Full content of the .zip file (e.g. a screenshot of WinRar with that archive opened)
3. Exact command that was executed
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: Extracting a zip file to its own folder

Post by autocart »

highend wrote:You want specific answers? Impossible without specific details...

Which ones?

1. Full path (and name) of the .zip file
2. Full content of the .zip file (e.g. a screenshot of WinRar with that archive opened)
3. Exact command that was executed
+1

CookieMonster

Re: Extracting a zip file to its own folder

Post by CookieMonster »

I don't know why you can't replace with your own examples. :eh:

text zip_extract("C:\2\5.zip","D:\2","image1.png|image2.png");

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Extracting a zip file to its own folder

Post by highend »

I don't know why you can't replace with your own examples.
I see no reason to do this...
text zip_extract("C:\2\5.zip","D:\2","image1.png|image2.png");
This is not what was executed when you posted the screenshot...

- Where is the screenshot of the contents of the .zip file?
- Was D:\2 created by executing the command?
One of my scripts helped you out? Please donate via Paypal

CookieMonster

Re: Extracting a zip file to its own folder

Post by CookieMonster »

highend wrote:
I don't know why you can't replace with your own examples.
I see no reason to do this...
To each his own !
text zip_extract("C:\2\5.zip","D:\2","image1.png|image2.png");
This is not what was executed when you posted the screenshot...

- Where is the screenshot of the contents of the .zip file?
- Was D:\2 created by executing the command?
What importance is there to show the contents of the zip file, the objection is getting the command to work and extract, whether it's one, two, three etc files from a compressed file.

The folder D:\2 was created prior to executing the command.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Extracting a zip file to its own folder

Post by TheQwerty »

I just tried replacing with my own example and it works correctly:

Code: Select all

text zip_extract($zip, $path, $files);
The popup shows the value of $path which is the target location. If I browse there I see the $files extracted from $zip. In my case $path didn't exist at the start so XY created it during the extraction.

Based on the provided details I believe you pressed incorrect keys.
Please don't do that.

CookieMonster

Re: Extracting a zip file to its own folder

Post by CookieMonster »

TheQwerty wrote:I just tried replacing with my own example and it works correctly:

Code: Select all

text zip_extract($zip, $path, $files);
The popup shows the value of $path which is the target location. If I browse there I see the $files extracted from $zip. In my case $path didn't exist at the start so XY created it during the extraction.

Based on the provided details I believe you pressed incorrect keys.
Please don't do that.

What is an incorrect key, enter ?

You are telling me, the files should be extracted in the folder C:\5, correct ?

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: Extracting a zip file to its own folder

Post by autocart »

CookieMonster wrote:I don't know why you can't replace with your own examples. :eh:

text zip_extract("C:\2\5.zip","D:\2","image1.png|image2.png");
My answer is: Because when I replace with my own examples, then it works. Therefore the next assumption would be that something is wrong with your input. Sorry, but that's how it is.

Did you try this with different configurations (paths, zip-files, network/local). This way you could 1) find out if it works with other details (e.g. maybe the zip file is simply corrupted) and 2) you could easily post the details of a not working dummy-setup with all anonymous paths/names.

CookieMonster

Re: Extracting a zip file to its own folder

Post by CookieMonster »

autocart wrote:
CookieMonster wrote:I don't know why you can't replace with your own examples. :eh:

text zip_extract("C:\2\5.zip","D:\2","image1.png|image2.png");
My answer is: Because when I replace with my own examples, then it works. Therefore the next assumption would be that something is wrong with your input. Sorry, but that's how it is.

Did you try this with different configurations (paths, zip-files, network/local). This way you could 1) find out if it works with other details (e.g. maybe the zip file is simply corrupted) and 2) you could easily post the details of a not working dummy-setup with all anonymous paths/names.
I'll try another zip file ! :blackstorm:

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Extracting a zip file to its own folder

Post by bdeshi »

Hey, run this script to test that all zip operations are in tiptop shape.

Code: Select all

 $zipdir = "<xydata>\<date yymmdd_hh_nn_ss>";
 new($zipdir, dir);
 zip_add("$zipdir\zipfile.zip", "<xydata>\ks.dat"); wait 400;
 zip_list("$zipdir\zipfile.zip", <crlf>, 1); wait 400;
 zip_extract("$zipdir\zipfile.zip", "$zipdir", "ks.dat"); wait 400;
 text listfolder("$zipdir",,4,<crlf>);
 delete 0,0, "$zipdir";
(if you get a textbox with `ks.dat<crlf>zipfile.zip` then it was successful)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Extracting a zip file to its own folder

Post by TheQwerty »

CookieMonster wrote:What is an incorrect key, enter ?
Apparently the ones you're pushing.
CookieMonster wrote:You are telling me, the files should be extracted in the folder C:\5, correct ?
No, what I'm saying is that when I give the correct parameters to zip_extract it works exactly as expected.

Based on the only information you seem willing to provide:

Code: Select all

text zip_extract("C:\2\5.zip","D:\2","image1.png|image2.png");
That will attempt to extract image1.png and image2.png from the archive C:\2\5.zip to the target path D:\2. Assuming those files are within that archive this should create D:\2\image1.png and D:\2\image2.png. After which zip_extract will return D:\2 which is then displayed by the text dialog.

When you tell the function to extract files to D:\2 it's going to put them there not magically put them in C:\5.

Post Reply