How do I recursively delete duplicate files using the terminal?

1

1

I'm using a mac, and just transferred a bunch o photos from another computer, and as it turns out, there is a bunch of duplicates...

So... I'm not too familiar with the mac terminal, but if there is a solution for linux, it will probably work for the mac.

Just need to be able to recursively scan all folders in my Pictures folder and then Delete them.

thanks

NullVoxPopuli

Posted 2011-03-01T17:57:04.740

Reputation: 499

Answers

2

Two methods:

Using commercial software

Try "Find Duplicate Files", it's free for 7 days.

Araxis Find Duplicate Files helps you to find, view and manage files that have duplicate content, regardless of name. It can be especially useful if you have large Pictures, Downloads or Documents folders.

Using fdupes

There's a handy tool called fdupes which finds duplicate files and allows you to delete them.

Install Homebrew using the guides on the homepage. It should work if you type:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Homebrew is a package manager that can install some of the most important Unix tools, including fdupes. After you have installed Homebrew, just type:

brew install fdupes

And after that, you will be able to scan your directory with:

fdupes -rd your-folder

This will prompt you whenever duplicates are found and ask you to delete or preserve them.

slhck

Posted 2011-03-01T17:57:04.740

Reputation: 182 472

+1 fdupes is exactly what I was looking for, thanks! – somedirection – 2016-12-31T15:15:20.730

Great! Homebrew has some other nice packages. If you ever look for Linux/Unix tools that OS X doesn't have, use brew search xyz :) – slhck – 2011-03-01T19:42:12.983