Guest User

Untitled

a guest
Jun 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. # pdfs.log in this case is the result of doing something like: find /a/directory/somewhere -name "*.pdf" > pdfs.log
  2.  
  3. for file in $(cat pdfs.log) ; do
  4. if [ ! -h $file ] ; then
  5. echo "Checking for duplicates of: $file"
  6. file_basename=$(basename "$file")
  7. for duplicate in $(cat pdfs.log) ; do
  8. if [ ! -h $duplicate ] ; then
  9. if [ "$duplicate" != "$file" ] ; then
  10. if [ "$(basename $duplicate)" = "$file_basename" ] ; then
  11. cmp -s $duplicate $file
  12. if [ $? -eq 0 ] ; then
  13. echo "ln -sf $file $duplicate"
  14. ln -sf $file $duplicate
  15. fi
  16. fi
  17. fi
  18. fi
  19. done
  20. fi
  21. done
Add Comment
Please, Sign In to add comment