Rdfind: Unterschied zwischen den Versionen

Aus Foxwiki
Die Seite wurde neu angelegt: „===== Rdfind ===== '''Rdfind''', stands for '''r'''edundant '''d'''ata '''find''', is a free and open source utility to find duplicate files across and/or within directories and sub-directories. * It compares files based on their content, not on their file names. * Rdfind uses '''ranking''' algorithm to classify original and duplicate files. * If you have two or more equal files, Rdfind is smart enough to find which is original file, and consider the rest…“
 
Keine Bearbeitungszusammenfassung
Zeile 49: Zeile 49:


To replace all duplicates with hardlinks, run:
To replace all duplicates with hardlinks, run:
 
<syntaxhighlight lang="bash" highlight="1" line>
$ rdfind -makehardlinks true ~/Downloads
rdfind -makehardlinks true ~/Downloads
</syntaxhighlight>


To replace all duplicates with symlinks/soft links, run:
To replace all duplicates with symlinks/soft links, run:
 
<syntaxhighlight lang="bash" highlight="1" line>
$ rdfind -makesymlinks true ~/Downloads
rdfind -makesymlinks true ~/Downloads
</syntaxhighlight>


You may have some empty files in a directory and want to ignore them.
You may have some empty files in a directory and want to ignore them.
* If so, use '''-ignoreempty''' option like below.
* If so, use '''-ignoreempty''' option like below.
 
<syntaxhighlight lang="bash" highlight="1" line>
$ rdfind -ignoreempty true ~/Downloads
rdfind -ignoreempty true ~/Downloads
</syntaxhighlight>


If you don’t want the old files anymore, just delete duplicate files instead of replacing them with hard or soft links.
If you don’t want the old files anymore, just delete duplicate files instead of replacing them with hard or soft links.


To delete all duplicates, simply run:
To delete all duplicates, simply run:
 
<syntaxhighlight lang="bash" highlight="1" line>
$ rdfind -deleteduplicates true ~/Downloads
rdfind -deleteduplicates true ~/Downloads
</syntaxhighlight>


If you do not want to ignore empty files and delete them along with all duplicates, run:
If you do not want to ignore empty files and delete them along with all duplicates, run:
 
<syntaxhighlight lang="bash" highlight="1" line>
$ rdfind -deleteduplicates true -ignoreempty false ~/Downloads
rdfind -deleteduplicates true -ignoreempty false ~/Downloads
</syntaxhighlight>


For more details, refer the help section:
For more details, refer the help section:
<syntaxhighlight lang="bash" highlight="1" line>
rdfind --help
</syntaxhighlight>


$ rdfind --help
And, the manual pages
 
<syntaxhighlight lang="bash" highlight="1" line>
And, the manual pages:
man rdfind
</syntaxhighlight>


$ man rdfind
; Suggested read
* [https://www.ostechnix.com/remove-duplicate-files-android-duplicate-files-fixer/ Remove Duplicate Files From Your Android With Duplicate Files Fixer]


'''Suggested read:'''* [https://www.ostechnix.com/remove-duplicate-files-android-duplicate-files-fixer/ Remove Duplicate Files From Your Android With Duplicate Files Fixer]
[[Kategorie:Linux/Datei]]
[[Kategorie:Linux/Befehl]]

Version vom 13. Oktober 2024, 20:24 Uhr

Rdfind

Rdfind, stands for redundant data find, is a free and open source utility to find duplicate files across and/or within directories and sub-directories.

  • It compares files based on their content, not on their file names.
  • Rdfind uses ranking algorithm to classify original and duplicate files.
  • If you have two or more equal files, Rdfind is smart enough to find which is original file, and consider the rest of the files as duplicates.
  • Once it found the duplicates, it will report them to you.
  • You can decide to either delete them or replace them with hard links or symbolic (soft) links.
Installing Rdfind

Rdfind is available in AUR.

  • So, you can install it in Arch-based systems using any AUR helper program like Yay as shown below.
sudo apt-get install rdfind
Usage

Once installed, simply run Rdfind command along with the directory path to scan for the duplicate files.

$ rdfind ~/Downloads

Rdfind command will scan ~/Downloads directory and save the results in a file named results.txt in the current working directory.

  • You can view the name of the possible duplicate files in results.txt file.
cat results.txt
# Automatically generated
# duptype id depth size device inode priority name
DUPTYPE_FIRST_OCCURRENCE 1469 8 9 2050 15864884 1 /home/sk/Downloads/tor-browser_en-US/Browser/TorBrowser/Tor/PluggableTransports/fte/tests/dfas/test5.regex
DUPTYPE_WITHIN_SAME_TREE -1469 8 9 2050 15864886 1 /home/sk/Downloads/tor-browser_en-US/Browser/TorBrowser/Tor/PluggableTransports/fte/tests/dfas/test6.regex
[...]
DUPTYPE_FIRST_OCCURRENCE 13 0 403635 2050 15740257 1 /home/sk/Downloads/Hyperledger(1).pdf
DUPTYPE_WITHIN_SAME_TREE -13 0 403635 2050 15741071 1 /home/sk/Downloads/Hyperledger.pdf
# end of file

By reviewing the results.txt file, you can easily find the duplicates.

  • You can remove the duplicates manually if you like.

Also, you can -dryrun option to find all duplicates in a given directory without changing anything and output the summary in your Terminal:

rdfind -dryrun true ~/Downloads

Once you found the duplicates, you can replace them with either hardlinks or symlinks.

To replace all duplicates with hardlinks, run:

rdfind -makehardlinks true ~/Downloads

To replace all duplicates with symlinks/soft links, run:

rdfind -makesymlinks true ~/Downloads

You may have some empty files in a directory and want to ignore them.

  • If so, use -ignoreempty option like below.
rdfind -ignoreempty true ~/Downloads

If you don’t want the old files anymore, just delete duplicate files instead of replacing them with hard or soft links.

To delete all duplicates, simply run:

rdfind -deleteduplicates true ~/Downloads

If you do not want to ignore empty files and delete them along with all duplicates, run:

rdfind -deleteduplicates true -ignoreempty false ~/Downloads

For more details, refer the help section:

rdfind --help

And, the manual pages

man rdfind
Suggested read