4

I've got ~50 zip files, each containing a similar directory structure but with different files inside.

Is there a way I can easily dir the contents of those zips?

I'm interested in creating a list of all the files with their relavite paths, such as a/b/c/file.txt

4

Download the command-line version of 7-zip (7za) and do a 7za -l. This will list the contents of the file. You can then, of course, put this into any kind of batch script.

  • The 'l' is a command, not a switch, so the correct invocation is "7za l your_archive.zip" – gravenimage Oct 1 '18 at 13:49
2

If you have jdk you can try jar:

$ /cygdrive/c/jdk1.6*/bin/jar -tf tcpmon-1.0-bin.zip
tcpmon-1.0-bin/
tcpmon-1.0-bin/apidocs/
tcpmon-1.0-bin/apidocs/org/
tcpmon-1.0-bin/apidocs/org/apache/
tcpmon-1.0-bin/apidocs/org/apache/ws/
tcpmon-1.0-bin/apidocs/org/apache/ws/commons/
tcpmon-1.0-bin/apidocs/org/apache/ws/commons/tcpmon/
tcpmon-1.0-bin/apidocs/org/apache/ws/commons/tcpmon/class-use/
  • will this work with wildcards? e.g., *.zip ? – DaveInCaz Oct 31 '17 at 14:58
1
  • Info-Zip's UnZip (in zipinfo mode):

    unzip -Z1 foo.zip
    zipinfo -1 foo.zip
    

    More information:

    unzip -Z foo.zip
    zipinfo foo.zip
    
  • 7z:

    7za l foo.zip
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.