fant0men

Movie list diff script

Dec 7th, 2019
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # This script goes through a list of basename filenames and searches for each filename in '/'.
  3. # If a filename can't be found, it's put in a new list ($of).
  4.  
  5. dir='/home/lucifer'
  6. if="${dir}/test123/find_movies-123_backup.txt"
  7. of="${dir}/find_movies_diff3_test.txt"
  8.  
  9. touch "$of"
  10. cat "$if" | while read line; do
  11.     name=$(sed -E 's/([^ A-Za-z0-9._-])/\\\1/g' <<<"$line")
  12.     mapfile -t files < <(find / -iname "${name}" 2>&-)
  13.     if [[ ${#files[@]} -eq 0 ]]; then
  14.         echo "$line" >> "$of"
  15.     fi
  16. done
RAW Paste Data