Advertisement
reloadfast

Series search script

Apr 17th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.74 KB | None | 0 0
  1. #!/bin/bash
  2. #sets the name of the file to read
  3. list=`cat listado.txt`
  4. for serie in $list
  5. do
  6.  
  7. #All in one line. looks within the given directory the read series and moves the result to the directory matching the series word. It excludes the destination folder from the search.
  8.  
  9. find /downloads/Complete/ -type f -iname "*$serie*.*" -not -path "/downloads/Complete/$serie/*" | xargs -I '{}' mv -v {} -t /downloads/Complete/$serie/;
  10.  
  11. #removes all nfo files except the tv info file
  12. find /downloads/Complete/ -type f ! -iname "tvshow.nfo" -iname "*.nfo" -delete;
  13.  
  14. #removes sample files
  15. find /downloads/Complete/ -type f -name "*sample*" -exec rm -f {} \;
  16.  
  17. #deletes empty directories.
  18. find /downloads/Complete/ -type d -empty -exec rmdir {} \;
  19. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement