Dealing with duplicate files

fDupes

Duplicate files are sorted in reverse order of latest modification time. So, the first file in the set of duplicates is the oldest in term of modification time (mtime). By default, the file with oldest mtime in each set of duplicates will be preserved and the rest will be deleted.

  • Recursive fdupes -r .
  • Delete with confirmation fdupes -r -d .
  • Delete without confirmation fdupes -r -d -N .
  • view only certain files: fdupes -r . | grep -e '.js$' -e '^$' | uniq
  • order by name fdupes -nrd --order=name .
  • fdupes -rdN [directory] ...
  • move files to another directory instead of deleting for f in $(fdupes -f .); do mv $f ./saveDirectory; done

Alternatives

Mac Install

$ brew install fdupes