Remove duplicate files on a Mac

Several solutions see to do the job.

These are:

  • Singular
  • dupeGuru
  • MrClean
  • FileBuddy9

Review:

I created a 2.7 GB directory of various duplicated files and ran them against each other.

Fastest: Singular, closely followed by dupeGuru. MrClean and FileBuddy trailed a long way behind.

Easiest to use: Singular starts off with a window asking you to drag your files into it. Super-simple. dupeGuru has more options on the initial screen which can be cumbersome. For example, you have to select which directories you wish to scan. However, the additional options allow you to add two different directories and also sort by size – very useful. MrClean and FileBuddy again have a rather complex initial setup.

Cons: FileBuddy obviously suffers from being an all-in-one application.

In conclusion, for a single directory, Singular is by far the easiest. However, if you wish to sort by size and/or check for duplicates on multiple directories then with dupeGuru wins out. One other consideration is that Singular has occasionally crashed with big directories whereas dupeGuru completed a 62GB directory scan comfortably.

Argument list too long – xargs is the solution…

If you’re dealing with a lot of files and get messages like:

mv *.* tmp/
-bash: /bin/mv: Argument list too long

then you need xargs. For example,

Moving Files: 

To move vast number of files from /a/b to /c/d do:

ls . | xargs -i mv /a/b/{} /c/d/{}

The -i argument to xargs says fill in all the {} expressions on the right hand side of the pipe with all the values being generated on the left hand side of the pipe. Or use:

find . -name “thisname-*” | xargs -i mv {} thisname/{}

 Deleting Files

find . -type f -name “*” -print|xargs rm

E.g. http://www.unixreview.com/documents/s=8274/sam0306g/