Created
February 7, 2016 18:18
-
-
Save stevekm/ca6c2b80d8baf01edb71 to your computer and use it in GitHub Desktop.
On Mac OS X, unrar a bunch of files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PassList="password1 password2 password3" && OldDir="$(pwd)" | |
for i in $PassList; do | |
for q in $(find . -name "*.rar"); do | |
echo "$q" | |
NewDir=$(dirname "$q") | |
echo -e "\t$NewDir" | |
cd "$NewDir" | |
~/Downloads/rar/unrar e -p${i} *.rar | |
cd "$OldDir" | |
done | |
done | |
# or do this one; use p7zip (from homebrew), OS X | |
for i in $PassList; do | |
for q in $(find -E . \( ! -regex '.*/\..*' \) -regex '.*(rar|7z)$'); do | |
echo "$q" | |
# NewDir=$(dirname "$q") | |
# echo -e "\t$NewDir" | |
# cd "$NewDir" | |
7z x "$q" -p$i | |
# cd "$OldDir" | |
done | |
done | |
# support multi-part rar | |
PassList="password1 password2 password3" | |
for i in $PassList; do | |
FILES=$(find -E . -type f -regex '.*(rar|7z)$' -regex '.*part1.*'); | |
for q in $FILES; do | |
echo "$q" ; | |
7z x "$q" -p$i | |
done | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment