To unzip all files in subdirectories while preserving the directory structure on macOS, you can use the find
command in combination with a simple shell loop. Here’s the correct command:
find . -name "*.zip" -execdir sh -c 'unzip -d "${1%.*}" "$1"' _ {} \;
This command will locate all .zip
files in the current directory and its subdirectories and unzip them in their respective subdirectories, preserving the directory structure.
Please ensure that you are running this command in the directory where you want to start the unzipping process, and you have the necessary permissions to extract files in those directories.