I found this command.
for f in *.zip; do unzip -d "${f%*.zip}" "$f"; done
I want something similar to this, but I want to extract my zip files from my ~/Downloads
folder to ~/Documents
.
So.
- Downloads
- zip1.zip
- zip2.zip
- zip3.zip
- Documents
- zip1/data.txt
- zip2/data.txt
- zip3/data.txt
Please, help!
Just prefix the path your provide in the -d flag with the Documents directory:
for f in *.zip; do unzip -d ~/Documents/"${f%*.zip}" "$f"; done
Note that the script still needs to be executed inside your downloads directory.