24

So I have a problem. I have WAY too many hard drives and backups from decades of computing. I just hoard everything. The issue is now I don't know what I have duplicates of and what I don't. or when I want to format an old external drive for something else, I'm not sure if I actually have a backup of it.

I just want a way to basically compare folders and see what files are missing or what are duplicates. I'm fine with CLI but I may prefer a GUI for this so I'm not deleting files by accident as easily...

I have searched around for this question but all the solutions seem way too complex for me.

top 16 comments
sorted by: hot top new old
[-] HaraldvonBlauzahn@feddit.org 1 points 4 hours ago

Say you have files in /home/bridgenjoyer/Data, /mnt/Backup, and /mnt/data

So

for d in /home/bridgeenjoyer/Data /mnt/backup /mnt/data
 do
    find $d -type f -print0
  done | xargs -0 md5sum | sort
  • generates a list of all plain files by path name
  • runs md5sum on them, which outputs a checksum as "checksum filename"
  • sorts them by checksum

So, for identical files, you get identical repeated checksum antries.

You can filter out repeated entries (e.g. using awk, a shell script, or python) and extract their name and path.

There are also various tools which deduplicate identical files by hard linking them, if they are on the same file system. These will get the same inode number shown with ls -l. You can find these tools in the Arch wiki.

Then you need a strategy how to organize these identical files. You cold put all files into an archive folder, tidy them up, and only make and keep backups which you don't modify.

[-] HaraldvonBlauzahn@feddit.org 1 points 4 hours ago

Oh, and one goodie: the "file" command can tell you the file type of a bunch of files, so you can quickly separate e.g. word documents from photos...

[-] DarkSirrush@piefed.ca 1 points 6 hours ago

If you only care about saving drive space, you can also just use a file system that has deduplication built in, like btrfs, and just run a dedup pass.

This doesn't deduplicate file references, but does save space on disk.

[-] frongt@lemmy.zip 13 points 16 hours ago

Easy question, hard answer.

If you want the easy answer: one new folder, look through everything you want to keep, and copy it to the new folder. Then delete the rest.

For a quick deuplication, fdupes will find exact duplicates. Read the man page, because there's a cache option you probably want to use.

If there are inexact duplicates, like photos or videos, use tools like czkawka.

[-] A_norny_mousse@piefed.zip 7 points 15 hours ago* (last edited 15 hours ago)

+1 for czkawka, it was the only thing that worked for my lazy brain. It also works for exact duplicates.

No matter the method though, the way OP describes it it's still going to be a slog. At least it was for me when I was in a similar situation.

[-] Botzo@lemmy.world 7 points 16 hours ago

rsync has a --dry-run / -n flag that would tell you which files would be synced. Combined with --archive /-a it runs recursively.

That said, it's assumes file paths are matching between source and destination, so if things are scattered, it might not work well.

If you're really scattered, I'd consider using a simple python script to walk directories and create a json file with results (maybe the sha256 for key and filename, size, absolute path, and created/modified stamps as fields). Then when you hit a duplicate key, you can dump the results and prompt a delete.

Or something. I'm just spit balling here.

[-] mrmaplebar@fedia.io 4 points 15 hours ago

I'm in the long process of sorting out tons of duplicate files too, and I'm using krokiet, which is the new GUI version of czkawka. It's not perfect, but it is the best tool I have found so far.

[-] hperrin@lemmy.ca 6 points 16 hours ago

There’s a couple programs I use.

Meld, for comparing folders exactly: http://meldmerge.org/

Czkawka for finding duplicate and similar files all scattered around: https://czkawka.net/

[-] redlemace@lemmy.world 5 points 16 hours ago

+1 for meld. Also, I use fdupes a lot just to see where many duplicates reside

[-] tapdattl@lemmy.world 5 points 16 hours ago

I was literally about to link czawka

[-] sainth@lemmy.world 4 points 16 hours ago

I'm only familiar with CLI tools but at least for smaller directories diff works well. Say you have a backup directory and you want to see how it differs from a source directory:

diff -rq /source/directory /backup/directory

Another trick is to use find to look for a unique file to see where, if at all, it's backed up:

find /backup/directory -name unique-file-name.jpg

[-] bridgeenjoyer@sh.itjust.works 3 points 16 hours ago

I could start with this !

I love CLI where I understand it I just am not as trusting when dealing witharge amounts of files. Of myself.

[-] Cyber@feddit.uk 1 points 12 hours ago

Basically you want something that will hash the file contents and compare hashes, this gets around filename differences.

Define where your "final" location will be and compare each drive to that (the 1st one will be the starting point, so pick the best , largest drive

fdupes / rmlint will get you most of the way there.

Then you'll want to compare similar files, so maybe something like meld or beyondcompare might help.

This will take a loooong time, but will be worth it

[-] Throbbing_banjo@lemmy.dbzer0.com 2 points 16 hours ago

I'm sure someone else has a better method, but I'd just use whatever file manager you have to consolidate everything into one folder and let the file system flag any dupes.

Have ten movie folders on a bunch of different drives? Pick the biggest one, attempt to move the next biggest one into it, ignore all dupes, repeat.

Again, though, there's probably a better way

[-] bridgeenjoyer@sh.itjust.works 2 points 16 hours ago

This would be my solution as well but I know there must be better ways !

[-] clay_pidgin@sh.itjust.works 1 points 14 hours ago

You could rsync everything into one pile, recursively walking through all directories. You'd need a way to smush duplicate files with different names, but also to catch the opposite case of different files with the same name.

this post was submitted on 17 Sep 2026
24 points (100.0% liked)

Linux

19128 readers
1436 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 3 years ago
MODERATORS