0

I have multiple folders where each folder got a zip file and i have a zip file extracting utility.this utility is command line based.i have tried the below, i want the batch to extract files in all folders.

for /f %%a in ('DIR g:\folder\ /b') do ( CD %%a g:\utility\7za e file_%%a.zip )

Thanks

1
  • And where it fails? It could be useful to describe your current problems. Commented Aug 11, 2014 at 11:19

2 Answers 2

3

Your question is unclear but this enters every folder in the g:\folder\ directory
and extracts "file_apple.zip" in the g:\folder\apple directory etc.

You may need to use the x switch of 7za instead of the e switch to retain folder structure.

@echo off
cd /d "g:\folder\"
for /f "delims=" %%a in ('DIR /ad /b') do (
   CD "%%a" 
   "g:\utility\7za" e "file_%%a.zip"
   cd ..
)
Sign up to request clarification or add additional context in comments.

Comments

0

In other words you have:

(example) g:\folder\folder1

you want to change to that directory, then extract file_folder1.zip ?

If you just want to extract all of the zip files beginning with file_ , just change your second line to

g:\utility\7za e file_*.zip

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.