Created
May 22, 2017 10:06
-
-
Save mbigatti/af2f9e0d7f777b709b94abf7ce81cc36 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# | |
# decompress - a bash script file to decompress a batch of rar files | |
# | |
password=$1 | |
file_count=$(ls *.part01.rar 2> /dev/null | wc -l) | |
if [ "$file_count" -eq "0" ] | |
then | |
echo "No file to decompress" | |
exit 0 | |
fi | |
# | |
# | |
# | |
clear | |
echo "Decompressing $file_count files" | |
if [ -z "$password" ] | |
then | |
echo "(running with no password)" | |
fi | |
echo | |
# | |
# run unrar | |
# | |
for FILENAME in $(ls *.part01.rar) | |
do | |
echo "Decompressing $FILENAME [$(date)]" | |
~/Applications/rar/unrar e -p$password $FILENAME > $FILENAME.log | |
done | |
# | |
# final check | |
# | |
echo | |
echo "Checking results..." | |
for FILENAME in $(ls *.log) | |
do | |
echo -n "$FILENAME >" | |
cat $FILENAME | grep "All OK" | |
done | |
echo | |
exit $file_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment