0

I have a set of subfolders with .gz files buried in them. I need to decompress the files and keep the directory structure the same. I have used

for /f "usebackq" %i in (`dir *.gz /s/b`) do 7za x %i

which will find the files and decompress them but sends the decompressed files to the root of the folder instead of keeping them in the directory they were found. Could someone tell me how I can decompress the files to the folders they were found?

0

Suppose you have C:\dir1\dir2 and dir2 and its sub-directories contain the .GZ files, run the following from C:\dir1:

for /r "dir2" %a in (.) do 7za x -o"%~a" "%~a\*.gz"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.