How to Unzip All Files in Subfolders on Linux Dealing with nested zip files can be a tedious manual task. Fortunately, Linux provides powerful command-line tools to automate this process in seconds. Whether you need to extract them all into one place or keep them in their original subdirectories, here is how you can get it done. 1. The Simple Solution: Unzip in Current Directory
shopt -s globstar
unzip **/*.zip
Tarballs (.tar.gz): find . -name "*.tar.gz" -exec tar -xzvf {} \; Quick Tips unzip all files in subfolders linux
: If the command is missing, install it via your package manager, such as sudo apt install unzip for Ubuntu/Debian. automatically delete the zip files after they are successfully extracted? How to Unzip All Files in Subfolders on
Breakdown:
for Loop with findIf you prefer readability and more control inside the loop, use a for loop that processes find results. Tarballs (
find /path/to/parent -name "*.zip" -type f -execdir unzip -o {} \;
Managing compressed files distributed across complex directory trees is a common administrative challenge. This report provides validated methodologies to recursively locate and extract ZIP files from all subfolders using standard Linux command-line tools. The primary solution utilizes a find and unzip pipeline, while alternative methods (shell loops and pigz-parallelized approaches) are presented for performance tuning. Edge cases—including password-protected archives, name collisions, and corrupted files—are addressed.
Running your command twice will cause unzip to prompt for overwrite (or automatically overwrite with -o), wasting time. To skip already-unzipped files: