Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ## First, let's unpack all the rar files
- echo "### Starting script"
- echo "------------------------"
- echo " "
- echo "### Unpacking all .rar-files"
- echo "------------------------"
- find /storage/Plex -name '*.rar' -execdir unrar x {} \;
- ## We've unpacked what needs to be unpacked.
- ## Let's clean up after ourselves.
- echo "### All rar-files unpacked. Finding any files to delete"
- echo "### Please stand by, this might take a while depeding on"
- echo "### your storage"
- echo "------------------------"
- ## Delete all .rar-files first
- find /storage/Plex -name "*.rar" -type f -delete
- ## And now we loop through *.r00 to *.r200 to delete all
- ## leftover files
- for i in {00..09};
- do
- find /storage/Plex -name "*.r$i" -type f -delete
- done
- for i in {10..200};
- do
- find /storage/Plex -name "*.r$i" -type f -delete
- done
- echo "### Script done executing."
- echo "### Have a great day :)"
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement