Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Script to unrar all .rar files and check for other endings on rar archive names
- #Note to use this properly change your search path's both for your download folder
- #but also the other folder to place all your extracted items. in my case unarchived
- #folder
- #This script was made by Snake, Aka xerxes 2012-03-26
- find /home/xerxes/downloads/* -iname "*.rar" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.r001" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.r01" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.r00" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.zip" -exec unzip -d {} /home/xerxes/downloads/unarchived/ \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.part001.rar" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.part01.rar" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
- #Lines to check that everything has been unpacked, stuff that does not have been unpacked will be moved to blacklist, please again here, specify your path for the blacklist file to be written and also the directory you want this file to be written in.
- #
- #
- #sleep 2
- #for file in $(find /home/xerxes/downloads -iregex '.*\.\(rar\|001\|zip)')
- #do
- # echo -n "checking file ${file##*/}..."
- # onblacklist=`grep -c $file /home/xerxes/downloads/blacklist`
- # if [ $onblacklist -ne 0 ]; then
- # echo "already unpacked"
- # else
- # echo "not unpacked yet"
- # echo -n "unpacking..."
- # unrar e -inul -o- $file
- # echo "done!"
- # echo -n "adding to blacklist..."
- # echo $file >> /home/xerxes/downloads/blacklist
- # echo "done!"
- # fi
- #done
- #sleep 1
- #The following lines below will ask for user input if you want to delete/remove remaining rar/zip archives
- read -p "Are you sure you want to continue? <y/N> " prompt
- if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
- then
- find /home/xerxes/downloads/* -iname "*.rar" -exec rm {} \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.r001" -exec rm {} \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.r01" -exec rm {} \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.r00" -exec rm {} \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.zip" -exec rm {} \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.part01.rar" -exec rm {} \;
- sleep 1
- find /home/xerxes/downloads/* -iname "*.part001.rar" -exec rm {} \;
- else
- exit 0
- fi
Add Comment
Please, Sign In to add comment