I have a large folder tree. Let's say there are folders named A, B, C, etc. through Z. Inside each folder are a number of zip files.

I can select all the zips in a folder, right click, select 7zip, and select Extract to "*" and it works perfectly. For example if I do that with the zips in folder A, A will contain a folder for each zip with the contents of the zip inside.

What I want to do is do a search for all zip files in ALL folders (A-Z) and perform this operation all at once, such that each of the folders (A-Z) end up with folders for all the zips they contain.

What actually happens is that 7zip extracts everything to the first folder it encounters (say, A).

Does anyone know a way to do this?

3 Answers 3


You could use the windows command line. Just hit the windows logo, type cmd and press ENTER. Then move to the directory containing the sub-directories with your zip files by typing cd c:\my\example\dir and ENTER, if it is on another drive, type e.g. i: and again ENTER to switch to that drive. Now, the correct path shall be shown before the cursor. Then type

for /F "usebackq" %f in (`dir /b/a:d`) do @echo %f

and ENTER. dir /b/a:d returns one row per directory. For each of these rows, the command behind do is executed. @echo %f will simply write the found names on your screen, so you can safely control what would be executed if you removed @echo. In your case, you'll need something like

for /F "usebackq" %f in (`dir /b/a:d`) do C:\APPS\7-Zip\7z.exe x .\%f\*.zip -o%f

which will for each sub-directory, call 7zip command line executable (you will need to adjust the path from C:\APPS\7-Zip\ to your system) and extract all zip files including their full path into the current sub-dir. More info on the 7zip syntax can be found at https://www.dotnetperls.com/7-zip-examples

In case you do this over and over again, you may create a simple .bat/.cmd file with above mentioned commando, but you will most likely need to replace % by %% to make it work.

  • I haven't had a chance to try this yet, but it's super cool. Thank you.
    – Robert M.
    Jan 27, 2022 at 22:32
  • Ok, hi Georg, I finally got around to trying this. It doesn't do quite what I want. I tried tweaking it but have had little luck. /F "usebackq" %f in (dir /b/a:d) do C:\APPS\7-Zip\7z.exe x .\%f*.zip -o%f does indeed go through each folder and unzip all the files in each folder. What I want, though, is for them to unzin into subfolders in each folder that have the same name as the zip file.
    – Robert M.
    Sep 26, 2022 at 21:23
  • [cont. due to char limit] For instance, if I have c:\big\a, c:\big\b, c:\big\c, etc. and the zip files in each folder are named a1.zip, a2.zip, a3.zip, b1.zip, b2.zip, etc., I want the zip in c:\big\a to zip into folders c:\big\a\a1, a:\big\a\a2, etc. Currently they all just unzip into z:\big\a. I tried [for /F "usebackq" %f in (dir /b/a:d) do "C:\Program Files\7-Zip\7z.exe" x .\%f*.zip -o*%f], and now it unzips each zip file into a folder with the same name as the zip file, but *all in the main folder i.e. c:\big\, not insize c:\big\a.
    – Robert M.
    Sep 26, 2022 at 21:28
  • [cont. due to char limit] What would be the correct command line for 7zip to make it do what I need? Vere grateful for your attention and time.
    – Robert M.
    Sep 26, 2022 at 21:29

I got it to work just the way I wanted. The correct command is:

for /F "tokens=*" %%g in ('dir /b/a:d') do "C:\Program Files\7-Zip\7z.exe" x ".\%%g\*.zip" -o"%g\*" -aos
  • 1
    If anyone is trying to use this without it creating a folder where the zip is nested with the same folder name twice, so two folders deep same name, change '-o"%g*"' to '-o"%g"' . Also, for those wondering, the '-aos' added here tells 7zip to overwrite any files with duplicate names without asking Jan 24, 2023 at 0:16

If you're using windows navigate to the root folder with the folders A, B, C & D then search *.zip or *.rar in windows search then select/highlight all the zips and use 7-zip to do whatever you want. Should work just fine with dolphin(linux) as well.

  • No, as I said in the OP, the folder for each of the zips will end up in one folder, in my experience, the first folder 7zip encounters. I want the folder created for each zip to be inside the folder where the zip was i.e. if the zip was in folder D, I want a folder zipfile1234 to be created in folder D.
    – Robert M.
    Aug 22, 2022 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .