Batch File: 7z.exe - DIR /s /b : Searching withing a ZIP file

Posted on 2010-08-17
Last Modified: 2013-12-01
Hi there,

In Windows Explorer, when a right-click on a foler an performs a search command, the search will also be done in ZIP files.

I need to do the same by using a command line.

I tried dir /s /b ".\All my zip files\*my needed document*.xls without success.

Question by:ReneGe
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

BasiKobrA earned 167 total points
ID: 33454687
Hi again,

If I am not mistaken, windows kind of unzips the zip files on-the-fly to be able to show you which files are in there or to let you search in them, however you can not just manipulate it like a directory as-is.

What exaclty do you want to do after the search ? With 7z you could '7z l yourArchive.7z' and, combined with the 'find' command' search for the specific string.
LVL 10

Author Comment

ID: 33456734
Makes sense.

Also knowing that Windows kind of Unzips the file to perform a search with in it, I then expect that I faile search within ZIP files will take ages.

I could also create an Index file, linking buth the files it containes and the ZIP file itself.

Lets see what others have to say about this.

LVL 54

Assisted Solution

by:Bill Prew
Bill Prew earned 333 total points
ID: 33460564
Not sure if I'm missing something, but using 7zip isn't this as simple as:

7z l "*my needed document*.xls"

or, if you need to search embedded folders in the zip:

7z l -r "*my needed document*.xls"

LVL 54

Assisted Solution

by:Bill Prew
Bill Prew earned 333 total points
ID: 33460569
And if you want to search many ZIPS, then something like this:

7z l *.zip "*my needed document*.xls"

LVL 10

Author Closing Comment

ID: 33461189
Thanks guys,

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WINZIP - command line function to output directory of all zipped files 17 76
Remote start and stop of service 3 69
How do I fix this situation in GIT? 2 73
Ruby or Python 7 127
This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question