Removing or avoiding .AppleDouble, Thumbs.db and other anoying helper files in Freenas

OS X and Windows have a number of annoying helper files they like to add to all directories as they are accessed (including those on network drives). These may not be so bothersome if you only work in one operating system but can become annoying if you use other OSs as well.

I archive photos on a large Freenas system that I keep backed up to another Freenas server via Rsync. Here are a few things I’ve found helpful in managing unwanted helper files:

Removing unwanted files recursively on Freenas

find . -name 'docname*' -print0 | xargs -0 rm -r

(derived from http://superuser.com/questions/61258/use-rm-to-remove-files-and-directories-recursively)

Avoiding unwanted files in Rsync

Here’s what I use for syncing Freenas fileservers:

#!/bin/bash rsync -avz --delete --exclude-from 'rsync-exclude-list.txt' --delete-excluded /mnt/your-freenas-archive/ user-on-backup-server@backup-server-address::backup-server-rsync-module/

Here’s the contents of rsync-exclude-list.txt referenced by the above script:

.Spotlight* .Trash* .AppleDouble* Thumbs.db .DocumentRevisions*