Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making the content list of files inside a Zip ?
#3
(02-05-2024, 03:21 PM)euklides Wrote: Well...
I'm looking for a way to list the files inside a zip file...

Than'ks for ideas.
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
  REM Sending the output of 7z into a file to use later
  7z.exe l -slt "SomeFileIZipped.zip" >"ZipListRAW.txt"
 
  REM Example of 7z.exe command with '-ba' switch
  REM 7z.exe l -ba -slt "SomeFileIZipped.zip"
 
  REM If you do not use '-ba' in the 7z command above, you can simply skip the first
  REM 11-12 lines of the file to get ONLY the filenames (skips past first line containing
  REM "Path" which contains the original archive filename.
 
  For /f "Usebackq Skip=11 Tokens=1,3* Delims= " %%a in ("ZipListRAW.txt") do (
    REM Checking if %%a equals word "Path"
    If "%%a"=="Path" (
      If [%%c]==[] (
        Echo %%b
      ) ELSE (
        Echo %%b %%c
      )
    )
  )
.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: Making the content list of files inside a Zip ? - by TerryRitchie - 02-05-2024, 06:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  More info about Random Access files PhilOfPerth 28 879 02-25-2026, 01:50 PM
Last Post: ahenry3068
  Exiting sub while inside a loop PhilOfPerth 5 510 12-05-2025, 09:40 AM
Last Post: PhilOfPerth
  Embedding and Extracting MANY files ! ahenry3068 20 1,509 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,428 04-14-2025, 09:19 PM
Last Post: madscijr
  List of file sound extensions eoredson 17 2,733 12-27-2024, 04:30 PM
Last Post: hsiangch_ong

Forum Jump:


Users browsing this thread: 1 Guest(s)