Unzip All Files In Subfolders Linux
bsdtar -xvf archive.zip -C destdir
Task: Unzip all .zip files under /data/incoming into folders named after each ZIP (e.g., file.zip → file/).
cd /data/incoming
find . -name "*.zip" -type f -exec sh -c '
base="$0%.zip"
mkdir -p "$base"
unzip -q "$0" -d "$base"
' {} \;
If you have enabled globstar in bash, you can avoid find: unzip all files in subfolders linux
shopt -s globstar
for zip in **/*.zip; do
unzip -o "$zip" -d "$zip%/*"
done
**/*.zip matches .zip files in all subdirectories recursively. $zip%/* extracts the directory part of the path. bsdtar -xvf archive
Appendix: Quick Reference Card
# Extract each ZIP into a sibling folder named ZIPNAME.extracted
find . -name "*.zip" -exec unzip {} -d {}.extracted \;
7z x archive.zip -oDEST