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

closed as unclear what you're asking by Anthon, Scott, Gilles, cas, garethTheRed May 29 '16 at 15:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 May 28 '16 at 12:55
  • the folder is /home/user/sambadata – blipman17 May 28 '16 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 May 29 '16 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 May 29 '16 at 9:28
  • 1
    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 Jun 1 '16 at 23:57