Page 2 of 3

Re: Extracting a zip file to its own folder

Posted: 04 Aug 2014 08:26
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 !

Re: Extracting a zip file to its own folder

Posted: 04 Aug 2014 08:39
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.

Re: Extracting a zip file to its own folder

Posted: 04 Aug 2014 09:18
by highend
Extracting specific files to a network path works perfectly fine with zip_extract() so it's simply a user error...

Re: Extracting a zip file to its own folder

Posted: 04 Aug 2014 21:22
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 :)

Re: Extracting a zip file to its own folder

Posted: 04 Aug 2014 22:38
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

Re: Extracting a zip file to its own folder

Posted: 04 Aug 2014 22:52
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

Re: Extracting a zip file to its own folder

Posted: 04 Aug 2014 23:12
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");

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 00:11
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?

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 02:26
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.

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 04:42
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.

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 05:13
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 ?

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 07:17
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.

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 07:37
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:

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 09:18
by SammaySarkar
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)

Re: Extracting a zip file to its own folder

Posted: 05 Aug 2014 13:26
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.