I've moved a lot of files and folders from my old nas to my new smb share. The problem is that someone made entire copies of nearly every folder on that thing. And I need the space.

I'm currently running fdupes in a screen and outputting everything to a file. But this will give me a huge list of duplicate files, which I have to filter into duplicate folders.

Are there any existing utilities which can find matching folders? Or can someone suggest a shell script that might do the job?

I'm running Ubuntu 14.04

  • What is a main folder? Is that a direct parent folder for the duplicates? Or some folder higher up in the hierarchy somewhere above the duplicates like /? What does 'there' (in "there you have to specify" to?
    – Anthon
    Commented May 28, 2016 at 12:55
  • the folder is /home/user/sambadata
    – blipman17
    Commented May 28, 2016 at 13:17
  • fdupes will give you a list of duplicate files, separated into paragraphs (one paragraph per set of dupes). Only YOU can decide which of those are "original" files that need to be kept, and which are duplicates to be deleted. BTW, this is probably obvious, but if the person who made the copies put them all under the one directory (and that directory doesn't have any important non-dupe files), just delete that directory.
    – cas
    Commented May 29, 2016 at 8:20
  • yeah, but the problem is that that person did that about every month for a few years long. It's pretty ugly.
    – blipman17
    Commented May 29, 2016 at 9:28
  • 3
    rmlint has an option to find duplicate dirs. You will need to follow the installation instructions to compile from source since it's not (yet) in the ubuntu/debian repositories. Then run rmlint --types=dupedirs --progress <path>.... It will generate a shell script rmlint.sh which you can then inspect and/or run to delete the duplicate dirs.
    – thomas_d_j
    Commented Jun 1, 2016 at 23:57


Browse other questions tagged .