Unzip All Files In Subfolders Linux May 2026

If you’ve ever downloaded a large dataset, a batch of game mods, or a collection of ebooks on Linux, you’ve likely encountered the same frustrating scenario: a parent folder filled with dozens (or hundreds) of subfolders, each containing one or more .zip archives. Opening each subfolder, right-clicking, and extracting manually is tedious, error-prone, and completely against the Linux philosophy of automation.

echo "Done."

while find . -name "*.zip" -type f | grep -q .; do find . -name "*.zip" -type f -exec unzip -o {} -d {}/.. \; find . -name "*.zip" -type f -delete # optional: remove original zip after extraction done This repeats until every nested ZIP is fully expanded. Remove the -delete line if you want to keep the original archives. If you have enabled globstar in bash, you can avoid find : unzip all files in subfolders linux

if [[ "$*" == "--delete" ]]; then DELETE_AFTER=true fi If you’ve ever downloaded a large dataset, a

if [[ "$*" == "--overwrite" ]]; then OVERWRITE="-o" else OVERWRITE="-n" fi -name "*

find "$SEARCH_DIR" -name "*.zip" -type f -print0 | while IFS= read -r -d '' zip; do target=$(dirname "$zip") echo "Extracting: $zip -> $target" unzip $OVERWRITE -q "$zip" -d "$target" if [ $? -eq 0 ] && [ "$DELETE_AFTER" = true ]; then rm "$zip" echo "Deleted: $zip" fi done

cd ~/Downloads/course find . -name "*.zip" -type f -exec unzip -n {} -d {}/.. \; The -n (never overwrite) protects already-extracted content. For repeated use, save this script as unzip-all.sh :