LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open file inside a .zip folder

Solved!
Go to solution

Why cant I go inside a .zip folder and open a file using labview. Why do I have to unzip it first which create memory issue for me.

I tried go in directly in the zip file to find the file but I could not. Can Labview do it or am I just doing it wrong....

0 Kudos
Message 1 of 15
(6,093 Views)
Solution
Accepted by topic author ritch_by_nature

Just because your explorer shell has support for opening zips natively, doesn't mean LabVIEW does.  The native LabVIEW zip functions cannot go inside a zip and pull out a single file from it.  But the OpenG zip tools developed well before the LabVIEW ones can do this.  Using the "Open Unzip" then "Extract" then "Close Unzip" you have the ability to pull out a single file, extracting it where you'd like.  It sounds like you really just want to be able to read the contents of it easily so you may want to extract it to a temp location, read it, then delete it when you are done.

 

The OpenG zip utilities can be found on the tools network or here, installed with VIPM.

 

EDIT:  I saw this on the idea exchange, you might want to go vote for it if you are interested in NI having this functionality.

Message 2 of 15
(6,065 Views)

In addition to what Hooovahh said, the OpenG library also supports extracting files from an archive directly into a (binary) string. Look for the ZLIB Extract Stream.vi instead of the ZLIB Extract File.vi. Then you can avoid the saving of a file to a temporary location to read it and having to delete it afterwards.

Rolf Kalbermatter
My Blog
Message 3 of 15
(6,056 Views)

I have done similar to what hooovahh described with OpenG, but I used 7Zip.  There is a nice command line interface so you can extract only the file you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 15
(6,033 Views)

Thanks a lot, I used your method and it works well. Now I just extract the files I want only.

Only problem is it does not read file from external drives. when I use it for my local C drive it works fine. On my E drive it gives me error 7, file not found.....Not sure why?

0 Kudos
Message 5 of 15
(5,989 Views)

It looks like there are some kinks in OpenG. Take a look at this lavag forum and make sure that your drive letter is specified in the correct case:

 

https://lavag.org/topic/16961-zlib-crio-vxworks-bug/#comment-104187

 

Otherwise, any error code screenshots that you could provide?

 

Best,

 

Sam R.
0 Kudos
Message 6 of 15
(5,964 Views)

Ok so I thought it was because of the zip folder was in the E drive. But I realize that's not the case. I used a diff Zip folder to extract files from and it worked fine. The other ones it does not when It goes extract the file. I check on access right on the file and everything is fine. But it gives Error 7 Lib Unzip Archive and when I open the Unzip Archive and analyze it. I notice that It sees the file but the call Library of the dll return 0 every time. 

0 Kudos
Message 7 of 15
(5,960 Views)

I really would like to check this, but your error description is pretty unclear to me. I don't understand which function returns that error nor which function does return 0!

 

Can you do some single stepping and explain to me exactly which low level VI returns what error or other specific values?

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 15
(5,946 Views)

@SamuRei wrote:

It looks like there are some kinks in OpenG. Take a look at this lavag forum and make sure that your drive letter is specified in the correct case:

 

https://lavag.org/topic/16961-zlib-crio-vxworks-bug/#comment-104187

 

Otherwise, any error code screenshots that you could provide?

 

Best,

 


That was on VxWorks cRIO targets. As far as I understand it the last problem was about USB or similar volumes under Windows and under Windows there definitely shouldn't be a case sensitivity in file names in any way.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 15
(5,945 Views)

Hi,

  These are the screen shots where the error happen. at the ZLIB open Unzip vi.

 At the call library function node, fist U32 output

Download All
0 Kudos
Message 10 of 15
(5,913 Views)