Advertisement
Guest User

Plex RAR unpack utility

a guest
Sep 15th, 2019
1,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. ## First, let's unpack all the rar files
  4.  
  5. echo "### Starting script"
  6. echo "------------------------"
  7. echo " "
  8. echo "### Unpacking all .rar-files"
  9. echo "------------------------"
  10.  
  11. find /storage/Plex -name '*.rar' -execdir unrar x {} \;
  12.  
  13.  
  14. ## We've unpacked what needs to be unpacked.
  15. ## Let's clean up after ourselves.
  16.  
  17. echo "### All rar-files unpacked. Finding any files to delete"
  18. echo "### Please stand by, this might take a while depeding on"
  19. echo "### your storage"
  20. echo "------------------------"
  21.  
  22. ## Delete all .rar-files first
  23.  
  24. find /storage/Plex -name "*.rar" -type f -delete
  25.  
  26. ## And now we loop through *.r00 to *.r200 to delete all
  27. ## leftover files
  28.  
  29. for i in {00..09};
  30. do
  31.         find /storage/Plex -name "*.r$i" -type f -delete
  32. done
  33.  
  34. for i in {10..200};
  35. do
  36.         find /storage/Plex -name "*.r$i" -type f -delete
  37. done
  38.  
  39. echo "### Script done executing."
  40. echo "### Have a great day :)"
  41.  
  42. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement