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

From WickyWiki
No edit summary
Line 17: Line 17:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
cat fdupes_list.txt | sed 's/\(^.*\$)/rm "\1"/g' > rm_dupes.sh
cat fdupes_list.txt | sed 's/\(^.*$\)/rm "\1"/g' > rm_dupes.sh
</syntaxhighlight>
</syntaxhighlight>


Line 23: Line 23:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
cat fdupes_list.txt | sed 's/\(^.*\$)/mv "\1" ~\/\.local\/share\/Trash\/files/g' > move_dupes_to_trash.sh
cat fdupes_list.txt | sed 's/\(^.*$\)/mv "\1" ~\/\.local\/share\/Trash\/files/g' > move_dupes_to_trash.sh
</syntaxhighlight>
</syntaxhighlight>

Revision as of 09:03, 1 November 2011

201103 Bash, Commandline

Create duplicates list

Options:

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

Create delete-file

cat fdupes_list.txt | sed 's/\(^.*$\)/rm "\1"/g' > 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