To avoid conflicts, create a directory for each archive:
For repeated use, save this script as unzip-all.sh :
find . -name "*.zip" -exec sh -c ' target="$0%.zip" mkdir -p "$target" unzip -o "$0" -d "$target" ' {} \; unzip all files in subfolders linux
Ensure you have read permission for the zip files and write permission for the target directories:
find /path/to/dir -name "*.zip" -type f | while read -r zipfile; do targetdir="$zipfile%.zip_extracted" mkdir -p "$targetdir" unzip "$zipfile" -d "$targetdir" echo "Extracted: $zipfile -> $targetdir" done To avoid conflicts, create a directory for each
: For 500 small zip files, xargs can be 3–5x faster than plain -exec .
find /path/to/parent/directory -name "*.zip" -type f -exec unzip {} -d {}.extracted \; To avoid conflicts
shopt -s globstar for f in **/*.zip; do unzip "$f" -d "$f%.*" done Use code with caution.