How to Unzip files recursively in Linux / DOS

0

I have a zipped folder which contains thousands of zipped folders contained in itself and that goes down the hierarchy, I have to unzip each and every file and place it in a single folder.

This task is platform independent either in linux or on windows.

Your help would be highly appreciated. Thankyou.

Murtaza

Posted 2012-07-18T06:51:49.127

Reputation: 31

Answers

0

I tried it the quick and dirty way and it worked for me. Create a script:

#!/bin/bash
function rec_unzip {
unzip $1 && rm $1
for i in $(find . -name "*.zip"); do
    if [ -f $i ]
    then
         rec_unzip $i
    fi
done
}
rec_unzip $1

execute the script with ./script_name.sh first_zip_file.zip.

You are free to modify it to supply target directories to unzip.

macrojames

Posted 2012-07-18T06:51:49.127

Reputation: 1