How do you recursively unzip archives in a directory and its subdirectories from the Unix command-line?

前端 未结 10 597
旧巷少年郎
旧巷少年郎 2020-12-04 07:15

The unzip command doesn\'t have an option for recursively unzipping archives.

If I have the following directory structure and archives:

/Moth         


        
10条回答
  •  一整个雨季
    2020-12-04 07:19

    Here's one solution that extracts all zip files to the working directory and involves the find command and a while loop:

    find . -name "*.zip" | while read filename; do unzip -o -d "`basename -s .zip "$filename"`" "$filename"; done;
    

提交回复
热议问题