Choose Language Hide Translation Bar
Highlighted
MJE
MJE
Level III

Navigate zipped folder for image import

Hi everyone,

 

I am currently struggling with the attempt of including graphics (tiff) from a zip archive. I did find several other discussions regarding this topic which seemed very promising, but I couldn't figure out a working syntax for my particular case.

 

Main issue I am dealing with right now is that all the discussions seem to have only one "layer" within the zip file (e.g. zip file with several text documents directly within). In my case, the graphics I am looking for are automatically zipped as a folder. Upon opening the zip file, I would have to navigate to said folder to actually retrieve the file list within (like [...]\filename.zip\foldername\graphics.tif). I mainly tried accessing it via different variations of this discussion as well as this post here. But whenever I try to generate a list of files within the zip file via "<<dir", it just gives back a blank list.

 

I tried so far to incorporate the sub folder within the open statement

za = open ("[...]\filename.zip\FolderName\", zip);

Show ( za << dir );

using the opened zip file reference to navigate further down (I can't remember the actual syntax I tried, already deleted it) or reading out distinct graphic files by filename from both versions

za = open ("[...]\filename.zip\FolderName\", zip);
dat = za << Read( "graphics.tif", Format( blob ) );    or   dat = za << Read( "folderName\graphics.tif", Format( blob ) );

Is there a syntax to navigate a folder structure within a zip file? Or, alternatively, is there a possibility to incorporate some "recursive" statement whilst opening the zip file as to get all the files which are nested somewhere further down below?

 

I am looking forward for any input you can share.

 

Best regards

Malte

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Craige_Hales
Staff (Retired)

Re: Navigate zipped folder for image import

This is confusing because many utilities present the contents of a zip file as if there is a hierarchical directory in the zip file. It is really a flat directory, and the zip directory has no requirement that the member names use forward or backward slashes in any particular way. I built test.zip using windows built in zip.

za=open("$desktop/test.zip","zip");
za<<dir
/*:

{"Folder2/fred.txt", "george.txt", "Folder1/ralph.txt", "Folder1/subsubFolder/",
"Folder1/subsubFolder/sam.txt"}


//:*/
za<<read("Folder1/subsubFolder/sam.txt");
/*:

"Sam's text"

Windows built in browser sees it like this

Windows explorer navigating through a zip archiveWindows explorer navigating through a zip archive

 

It looks like you'll need forward slashes rather than back slashes in the member names.

Craige

View solution in original post

Highlighted
Craige_Hales
Staff (Retired)

Re: Navigate zipped folder for image import

2GB is the limit on both the size of a string in JMP and the size of a zip member in JMP's zip archive support.

(2GB is 2^31; that is the largest number that fits in a 32-bit signed integer.) 

JMP blobs are not limited to 2GB. I think a future version of JMP may allow for zip members bigger than 2GB as well, which could then be read into a blob. @Paul_Nelson 

 

You might be able to script an external zip program using JMP's runprogram. The external program might support >2GB if it is fairly recent.

Craige

View solution in original post

3 REPLIES 3
Highlighted
Craige_Hales
Staff (Retired)

Re: Navigate zipped folder for image import

This is confusing because many utilities present the contents of a zip file as if there is a hierarchical directory in the zip file. It is really a flat directory, and the zip directory has no requirement that the member names use forward or backward slashes in any particular way. I built test.zip using windows built in zip.

za=open("$desktop/test.zip","zip");
za<<dir
/*:

{"Folder2/fred.txt", "george.txt", "Folder1/ralph.txt", "Folder1/subsubFolder/",
"Folder1/subsubFolder/sam.txt"}


//:*/
za<<read("Folder1/subsubFolder/sam.txt");
/*:

"Sam's text"

Windows built in browser sees it like this

Windows explorer navigating through a zip archiveWindows explorer navigating through a zip archive

 

It looks like you'll need forward slashes rather than back slashes in the member names.

Craige

View solution in original post

Highlighted
MJE
MJE
Level III

Re: Navigate zipped folder for image import

Hi @Craige_Hales

 

thank you for your quick answer, I did get the syntax to work using your input. Unfortunately, I could not get it to work for my original object of desire...

 

As it turns out, I am able to open and read out some zip files using exactly the syntax you provided (independent whether a slash or a backslash is being used) whilst others still give back only blank lists.

The main difference between files I can open and those I can't open seems to be the actual size of the zip file. After messing around a bit trying to open several files, it seems as if there is a hidden boundary when the file size of the zip file exceeds roughly 2GB (I will have to check back with our it department to see whether there are other differences in the files which i cannot access/determine).

I already tried to implement waiting times of 20 seconds between opening and reading out the directory as well as between reading out the directory and showing it in the log, to make sure it is not related to computing times/jmp hickups. Until now to no avail.

 

Do you know about any size limitations when opening zip files via jmp or do you have any other suggestions what to try?

 

Best Regards

Malte

Highlighted
Craige_Hales
Staff (Retired)

Re: Navigate zipped folder for image import

2GB is the limit on both the size of a string in JMP and the size of a zip member in JMP's zip archive support.

(2GB is 2^31; that is the largest number that fits in a 32-bit signed integer.) 

JMP blobs are not limited to 2GB. I think a future version of JMP may allow for zip members bigger than 2GB as well, which could then be read into a blob. @Paul_Nelson 

 

You might be able to script an external zip program using JMP's runprogram. The external program might support >2GB if it is fairly recent.

Craige

View solution in original post

Article Labels

    There are no labels assigned to this post.