02-05-2024, 03:21 PM
Well...
I'm looking for a way to list the files inside a zip file...
Than'ks for ideas.
I'm looking for a way to list the files inside a zip file...
Than'ks for ideas.
Why not yes ?
|
Making the content list of files inside a Zip ?
|
|
02-05-2024, 03:21 PM
Well...
I'm looking for a way to list the files inside a zip file... Than'ks for ideas.
Why not yes ?
02-05-2024, 05:45 PM
The noticing will continue
02-05-2024, 06:12 PM
(This post was last modified: 02-05-2024, 06:20 PM by TerryRitchie.)
(02-05-2024, 03:21 PM)euklides Wrote: Well...I was playing around with 7Zip ( 7z.exe ) to see if I could get the results you want. The best I could get was this: 7z l -ba filename.zip which lists output like this: 2014-08-21 00:37:55 ....A 1078326 45840 filename.ext 2014-08-22 10:19:59 ....A 13733 anotherfile.txt ... ... etc.. ... You would need to parse out the information using code with this method of putting the listing into a file like so: 7z l -ba filename.zip > filelist.txt However, I also found a batch file that strips everything except the file names themselves here: https://stackoverflow.com/questions/5535...-filenames A full explanation of how the batch file works is included in the link above. Read the entire posting as others posted alternative methods using powershell scripts as well. Pick the one you like best. Code: (Select All) @Echo Off
02-05-2024, 06:48 PM
How bout trying the new _files command and saving to file before you zip a folder?
before _files command I was taking a snapshot of folder in Windows Navigator to show (with GUI stuff) but you can't do sub-folders too well that way.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
02-05-2024, 08:59 PM
I you want to read the zip central directory to get the files names programmatically (in a platform independent way), then you can use the APIs from libraries like zlib, miniz etc.
With a little bit of mixed language programming, it should be possible.
02-06-2024, 12:56 PM
This seems to work:
Code: (Select All)
02-06-2024, 02:43 PM
Thank's for ideas and programs.
With 7z.exe , I knew this solution. But I wanted a program working exclusively with QB64. Visionmercer give the very good solution for this... Thank you all.
Why not yes ?
02-06-2024, 03:20 PM
(This post was last modified: 02-06-2024, 03:23 PM by TerryRitchie.)
Very cool @visionmercer
I hope you don't mind but I took the liberty of converting the subroutine to a function . The code also starts populating the array at index position 1 instead of 0. I made a few minor changes in the function to streamline a bit and to close the file when finished. By the way, this code only works with .ZIP files and not .7z files. Code: (Select All)
Thank's
And if you also want to know filesize: Do Get ff, , head If head.signature <> Chr$(&H50) + Chr$(&H4B) + Chr$(&H03) + Chr$(&H04) Then Exit Do fname = Space$(head.filenameLen) FX$ = Space$(head.uncompressedSize) Get ff, , fname If filecount > UBound(strarr) Then ReDim _Preserve strarr(filecount) As String strarr(filecount) = fname + "|" + _Trim$(Str$(Len(FX$))) filecount = filecount + 1 Seek ff, Seek(ff) + head.extrafieldLen + head.compressedSize Loop Until EOF(ff) And the program works with *.epub files (that was my problem; epub are zip files)
Why not yes ?
02-06-2024, 05:38 PM
(02-06-2024, 05:04 PM)euklides Wrote: Thank'sExcellent addition. A lot of file types are actually ZIP files in disguise. If the first two bytes of a file are 80 and 75 decimal, "PK", then the underlying data is more than likely a ZIP file in disguise. |
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| More info about Random Access files | PhilOfPerth | 28 | 831 |
02-25-2026, 01:50 PM Last Post: ahenry3068 |
|
| Exiting sub while inside a loop | PhilOfPerth | 5 | 506 |
12-05-2025, 09:40 AM Last Post: PhilOfPerth |
|
| Embedding and Extracting MANY files ! | ahenry3068 | 20 | 1,498 |
11-15-2025, 10:19 AM Last Post: ahenry3068 |
|
| Erasing (or making a section of an image transparent) based on a mask from image #2? | madscijr | 17 | 2,402 |
04-14-2025, 09:19 PM Last Post: madscijr |
|
| List of file sound extensions | eoredson | 17 | 2,681 |
12-27-2024, 04:30 PM Last Post: hsiangch_ong |
|