Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I extract all .zip in subfolders?

I have a folder with hundreds of subfolders that each contain a .zip files. How do I extract all the .zip files in the subfolders without going to each individual subfolder and extracting it. (While keeping the unzip files within it's own sub-folder)

3 Answers

Relevance
  • Darrel
    Lv 4
    9 years ago
    Favorite Answer

    From a command prompt, you can use a command similar to the following to recurse through all files in a folder. I'm using *.zip, but you can use any filter you want there.

    FOR /R %i IN (*.zip) DO "command"

    This will recurse through the folder, and pass the matching filenames in as "%i". To see how it works, you can use the @echo command to print out the filenames that match. ("%~dpi" would be just the folder name)

    FOR /R %i IN (*.zip) DO @echo Filename is "%i", folder is "%~dpi"

    So if you were using 7-Zip, you could use a command like:

    FOR /R %i IN (*.zip) DO "c:\program files\7-zip\7z.exe" x "%i" -o"%~dpi"

  • 9 years ago

    One way is with a batch file. The three main zip type file programs, WinRAR, WinZip and 7-Zip all have CLI (command line interface) parts.

    WinZip - http://www.winzip.com/downcl.htm

    WinRAR - http://www.respower.com/page_tutorial_unrar

    7-Zip - http://www.7-zip.org/download.html

    One method to find all the zip files within your main directory is to write a dir command to get them into a file then work your way through the file working on each entry...

    mkdir c:\zipped

    dir drive:\path\*.zip /b /s > c:\zipped\files.txt

    for /F "tokens=*" %%a in (c:\zipped\files.txt) DO (

    ....

    )

    Another method doesn't require the dir command

    mkdir c:\zipped

    for /r drive:\path %f in (*.zip) do echo %f >> c:\zipped\files.txt

    for /F "tokens=*" %%a in (c:\zipped\files.txt) DO (

    ....

    )

    For /r - Walks the directory tree rooted at [drive:]path, executing the FOR statement in each directory of the tree. If no directory specification is specified after /r then the current directory is assumed. If set is just a single period (.) character then it will just enumerate the directory tree - http://www.computerhope.com/forhlp.htm

    %f - a variable

    * - ALL wildcard

    echo - write the result (usually to the screen, but this is changed using >> or >)

    >> redirect, append ( > simply overwrites the file)

    files.txt - the file name, can be anything you like

    You may even be able to do away with the text file list as well, but I haven't tried that.

    for /r drive:\path %f in (*.zip) DO (

    ....

    )

    Where .... is the command lines from whichever zip file utility you use. You'll have to read about the various zip CLIs.

    To write a batch file simply write the code in Notepad and save the file with a .bat extenstion. Simply double clicking on the file will run it.

  • Anonymous
    7 years ago

    Hi,

    To open compressed files (zip rar jar iso 7z cab uue gz....) you have to use WinRar. With WinRar you can easily decompress files and folders.

    You can find a recent release of Winrar here: http://bit.ly/1p3PcKC

    Regards

Still have questions? Get your answers by asking now.