Find duplicate files and create delete-file: Difference between revisions
From WickyWiki
Created page with "201103 Bash, Commandline 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, i..." |
m 12 revisions |
||
| (11 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
201103 | [[Category:Ubuntu]] | ||
[[Category:Bash]] | |||
[[Category:201103]] | |||
== Create duplicates list == | |||
Options: | Options: | ||
* -r recursive | * -r recursive | ||
** Note: this can take considerable time | |||
** Note: with fdupes version 1.50-PR2 it seems that option "-r" with option "-n" will not recurse into folders that only contain a folder. | |||
* -n ignore empty files | * -n ignore empty files | ||
* -f ommit first | * -f ommit first occurrences | ||
** Note: the exact order is not quite clear, it will help to do dirs | ** 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) | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
fdupes -r -n -f | fdupes -r -n -f /home/user > fdupes_list.txt | ||
</syntaxhighlight> | |||
== Create delete-file == | |||
<syntaxhighlight lang=bash> | |||
cat fdupes_list.txt | sed 's/\(^.*$\)/rm "\1"/g' > rm_dupes.sh | |||
chmod u+x rm_dupes.sh | |||
</syntaxhighlight> | |||
Or move them to trash: | |||
<syntaxhighlight lang=bash> | |||
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 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 07:25, 5 July 2013
Create duplicates list
Options:
- -r recursive
- Note: this can take considerable time
- Note: with fdupes version 1.50-PR2 it seems that option "-r" with option "-n" will not recurse into folders that only contain a folder.
- -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