Find duplicate files and create delete-file: Difference between revisions

From WickyWiki
No edit summary
Line 1: Line 1:
201103 Bash, Commandline
201103 Bash, Command-line


== Create duplicates list ==
== Create duplicates list ==
Line 6: Line 6:
* -r recursive - NB: this can take some time
* -r recursive - NB: this can take some time
* -n ignore empty files
* -n ignore empty files
* -f ommit first occurences
* -f ommit first occurrences
** Note: the exact order is not quite clear, it will help to do dirs seperately
** Note: the exact order is not quite clear, it will help to do dirs separately
* -S show size
* -S show size
* -d delete (prompted)
* -d delete (prompted)

Revision as of 09:08, 1 November 2011

201103 Bash, Command-line

Create duplicates list

Options:

  • -r recursive - NB: this can take some time
  • -n ignore empty files
  • -f ommit first occurrences
    • Note: the exact order is not quite clear, it will help to do dirs separately
  • -S show size
  • -d delete (prompted)
fdupes -r -n -f /home/user > fdupes_list.txt

Create delete-file

cat fdupes_list.txt | sed 's/\(^.*$\)/rm "\1"/g' > rm_dupes.sh
chmod u+x rm_dupes.sh

Or move them to trash:

cat fdupes_list.txt | sed 's/\(^.*$\)/mv "\1" ~\/\.local\/share\/Trash\/files/g' > move_dupes_to_trash.sh
chmod u+x move_dupes_to_trash.sh