7-Zip: How to list contents of a folder and subfolder of zip files without extracting (Win XP,Vista,7 and Command Line)

This tech-recipe will explain how to use 7-Zip to create a text file (tab delimited) listing of the contents of a zip file.  You can run this .bat file in a directory and get the listings of every ZIP file contained in that directory and any sub-directories.  Keep reading for the commands and explanation.

Required Software/Skills:

-7-Zip (free, v4.65 as of recipe creation)

-Windows XP, Vista, 7

-Basic batch file knowledge (how to create, run)

1. Download and install 7-Zip.

2. Navigate to the 7-Zip install directory (C:\Program Files\7-Zip\) and copy these three files and paste them into a folder  on our desktop called “7zip”




These files will be used with our batch (.bat) file we create to do our directory listing and content listing of the zip file.

3. Open Notepad (Start Menu > All Programs > Accessories > Notepad or Start button + R, type “Notepad” and hit Enter)

4. Insert this code (copy and paste from below) into Notepad.

FOR /F "tokens=* delims=" %%A in ('dir /b /s *.zip') do (7z.exe l -r "%%A" >> listing.txt)

5. Then click on File > Save. Browse to our Desktop and the 7zip folder. Click the “Save as type:” drop-down and choose “All Files“. Give it a name of ziplist.bat and hit the Save button.

6. Copy the four files from the 7zip folder on our desktop: 7z.dll, 7z.exe, 7z.sfx, ziplist.bat to the folder that contains the zip files and other sub-folder of zip files.

7.  Finally, run the ziplist.bat by double-clicking on it.  This batch file will do the following using a FOR statement:

It will do a directory listing of the current folder and all subfolders for any file with a .zip extension.  If it finds any, it will then send the path to 7-zip’s command line exe and then output the contents listing to a text file called listing.txt.  This file will be saved in the same folder that the ziplist.bat is located in.

You can then import the text file into Excel or any other spreadsheet program as a Tab Separated file.  Use TAB as your delimiter in Excel when importing the data.


About Jimmy Selix

Jimmy Selix is an early adopter that loves to be one of the first on the block to have the latest and greatest in technology and gadgets. Another love of his is being able to share his knowledge to others seeking it. Feel free to drop any comments or questions that you may have.
View more articles by Jimmy Selix

The Conversation

Follow the reactions below and share your own thoughts.

9 Responses to “7-Zip: How to list contents of a folder and subfolder of zip files without extracting (Win XP,Vista,7 and Command Line)”

  1. December 07, 2010 at 10:45 pm, Mike Dary said:

    how do you make the output list the files alphabetically?


  2. September 13, 2011 at 12:50 am, JedrekWie said:

    Very nice article. It helped me a lot. Thank you!


  3. April 07, 2012 at 7:20 pm, David said:

    Thanks, come in handy used your formula to list .rar archives instead of zip :)

    just to say thank you


  4. October 14, 2012 at 9:17 am, tiger said:

    great! thank you very much!


  5. October 19, 2012 at 10:12 am, benn said:

    really nice thx


  6. January 15, 2013 at 1:45 pm, Erin said:

    I have a section on my website where .zip files may be downloaded. I uploaded a new file replacing another file via FTP. What do i need to do in my PHP coding to get it to update and recognize the change?


  7. February 05, 2013 at 10:50 pm, rae said:

    Is this still an active thread? This works well, but does not show contents of zipped files inside of zipped files. Do you have a solution to this problem? Thank you


  8. April 06, 2013 at 4:21 pm, Harmeet Singh said:

    Hi i would like to create a batch file to run 7 zip to archive multiple directories one after the other

    Folder 1
    Folder 2
    Folder 3

    i want to create a batch file to run 7 zip to zip all these folders at night so that i can get
    zipped files by morning
    please help me


  9. June 04, 2013 at 9:20 am, Niles said:

    Unbelievably useful! Solved a huge problem I had – so thanx a million!


Leave a Reply