BASH: Checking if files are duplicates within a directory?

后端 未结 3 1160
不知归路
不知归路 2021-01-24 17:25

I am writing a house-keeping script and have files within a directory that I want to clean up. I want to move files from a source directory to another, there are many sub-direct

相关标签:
3条回答
  • 2021-01-24 18:03
    find . -type f -exec md5sum {} \; | sort | uniq -d
    

    That'll spit out all the md5 hashes that have duplicates. then it's just a matter of figuring out which file(s) produced those duplicate hashes.

    0 讨论(0)
  • 2021-01-24 18:03

    dupmerge is another such tool...

    0 讨论(0)
  • 2021-01-24 18:07

    There's a tool designed for this purpose, it's fdupes :

      fdupes -r dir/
    
    0 讨论(0)
提交回复
热议问题