What to do when you have 500GB+ worth of files to process?

  1. Reserve a couple of nights to let the inner autist out
  2. Find a job-student for monkey labour
  3. Start CLI scripting

A collection of useful scripts:

Back up

Make sure you only work on a back-up. You will make mistakes, and won't have cmd+Z as fall-back. If you don't have ample space and are too lazy to get an extra disk, work in chunks.
Don't risk it.

Clean out

Once you go through years of collected backup, ghost files will appear. It's in the nature of everything unused.

Remove empty files

find . -type f -empty -delete

Keep in mind that eg. txt file with only a name, used as marker, will also be removed.
The same goes for folders:

find . -type d -empty -delete


Don't listen to woos pressing you to install apps. You can CLI your way out - usually your question is too specific anyway. The upside of bash scripting is it's simplicity and flexibility.

Shrink image sizes

mdfind -0 -onlyin . "kMDItemPixelHeight > 4200 || kMDItemPixelWidth > 4200" | xargs -0 sips -Z 4200

This is Spotlight savvy. Take all images with a dimension box greater then 4200, and shrink it.

Convert image types

find . -iname "*.tif" -type f -exec sh -c 'sips -s format png "$0" --out "${0%.tif}.png"' {} \;

Go through all folders recursively, search for a certain format (tiff in this case), and convert to png. sips handles jpeg, tiff, png, gif, jp2, pict, bmp, qtif, psd, sgi, tga. Impressive.

Remove image types

find . -type f -iname "*.tif" -delete

Once you converted the images, tested the result by previewing a couple, you can safely remove the old ones. You obviously can use -regex for multiple file extensions.