Guest User

Untitled

a guest
Jul 15th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. #!/bin/bash
  2. #Script to unrar all .rar files and check for other endings on rar archive names
  3. #Note to use this properly change your search path's both for your download folder
  4. #but also the other folder to place all your extracted items. in my case unarchived
  5. #folder
  6. #This script was made by Snake, Aka xerxes 2012-03-26
  7. find /home/xerxes/downloads/* -iname "*.rar" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
  8. sleep 1
  9. find /home/xerxes/downloads/* -iname "*.r001" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
  10. sleep 1
  11. find /home/xerxes/downloads/* -iname "*.r01" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
  12. sleep 1
  13. find /home/xerxes/downloads/* -iname "*.r00" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
  14. sleep 1
  15. find /home/xerxes/downloads/* -iname "*.zip" -exec unzip -d {} /home/xerxes/downloads/unarchived/ \;
  16. sleep 1
  17. find /home/xerxes/downloads/* -iname "*.part001.rar" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
  18. sleep 1
  19. find /home/xerxes/downloads/* -iname "*.part01.rar" -exec unrar x {} /home/xerxes/downloads/unarchived/ \;
  20.  
  21. #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.
  22. #
  23. #
  24. #sleep 2
  25. #for file in $(find /home/xerxes/downloads -iregex '.*\.\(rar\|001\|zip)')
  26. #do
  27. # echo -n "checking file ${file##*/}..."
  28. # onblacklist=`grep -c $file /home/xerxes/downloads/blacklist`
  29. # if [ $onblacklist -ne 0 ]; then
  30. # echo "already unpacked"
  31. # else
  32. # echo "not unpacked yet"
  33. # echo -n "unpacking..."
  34. # unrar e -inul -o- $file
  35. # echo "done!"
  36. # echo -n "adding to blacklist..."
  37. # echo $file >> /home/xerxes/downloads/blacklist
  38. # echo "done!"
  39. # fi
  40. #done
  41. #sleep 1
  42. #The following lines below will ask for user input if you want to delete/remove remaining rar/zip archives
  43. read -p "Are you sure you want to continue? <y/N> " prompt
  44. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
  45.  
  46. then
  47. find /home/xerxes/downloads/* -iname "*.rar" -exec rm {} \;
  48. sleep 1
  49. find /home/xerxes/downloads/* -iname "*.r001" -exec rm {} \;
  50. sleep 1
  51. find /home/xerxes/downloads/* -iname "*.r01" -exec rm {} \;
  52. sleep 1
  53. find /home/xerxes/downloads/* -iname "*.r00" -exec rm {} \;
  54. sleep 1
  55. find /home/xerxes/downloads/* -iname "*.zip" -exec rm {} \;
  56. sleep 1
  57. find /home/xerxes/downloads/* -iname "*.part01.rar" -exec rm {} \;
  58. sleep 1
  59. find /home/xerxes/downloads/* -iname "*.part001.rar" -exec rm {} \;
  60. else
  61. exit 0
  62. fi
Add Comment
Please, Sign In to add comment