Is there any way to exclude specific file types from Time Machine backups?

Hi,


I store my photos on an external hard drive. I don't want to back these up via Time Machine - as I back them up when I load them on to the computer. However, I would like time machine to backup their associated *.xmp files which change whenever I process my photos.


Is there any way to set time machine up to exclude a specific file type (or even to include a specific file type..)? I know you can exclude folders but the this won't help here as the *.xmp files reside in the same folder as the photos...


Any advice would be much appreciated…..


Many thanks, Karen



P.S.

I'm currently running Lion and am repairing to upgrade to Yosemite in the next few days….

Mac OS X (10.7.5)

Posted on Jul 14, 2015 2:20 PM

Reply
9 replies

Jul 14, 2015 7:17 PM in response to KEP27

Time Machine allows you to exclude volumes, folders, and files, but not exclude by specified file type. If you want to exclude your photos but not their corresponding XMP files, move the XMP files out of the folder containing your photos and into a separate folder. If there are files in the folder with your photos you don't want excluded, remove them as well. Then add the folder containing your photos to Time Machine's exclusion list from the Time Machine panel in System Preferences.


If you want your exclusion to be location-independent or "sticky", so that no matter where you relocate it to it will be excluded, even if copied, use the Time Machine utility, tmutil, from the command line with Terminal.app. For instance, to exclude a folder use this command substituting your path information:

tmutil addexclusion /path/to/my/folder


To verify the folder is excluded use:

tmutil isexcluded /path/to/my/folder


To remove the folder from the exclusion list use:

tmutil removeexclusion /path/to/my/folder


Output will indicate either [Excluded] or [Included] and the path when you verify depending upon whether you've added or removed the folder from the exclusion list. Note that exclusions set using tumuli on the command line won't display in Time Machine's exclusion list in System Preferences.


https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man8/tmutil.8.html

Jul 18, 2015 6:35 PM in response to KEP27

The @ suffix indicates a file has an extended attribute containing metadata. For instance, XMP sidecar files may contain adjustments made to images with Photoshop Camera Raw. Files may also contain other metadata, for instance from the Finder (com.apple.FinderInfo:), text encodings (com.apple.TextEncoding:), File Quarantine (com.apple.quarantine:), etc.


The chmod command sets Unix file permissions and isn't related to a file's extended attribute. The 3 files you mention already have read, write, and execute permissions for user, group, and others (rwxrwxrwx).


OS X also supports BSD file flags which override the UNIX file permissions. If a file has a user immutable flag set, meaning the file cannot be moved, renamed, or deleted except by root in single-user mode, you can disable it with the chflags command:

chflags nouchg /path/to/my/file


To disable the system immutable flag for a file by the super-user only, you can use the command (password required):

sudo chflags noschg /path/to/my/file


If you want to view a file's extended attributes, you can use the xattr command:

xattr -l /path/to/my/file


More info:


File System Programming Guide

OS X Man Pages - CHFLAGS(1)

OS X Man Pages - XATTR(1)

Jul 16, 2015 1:10 PM in response to Roote

Hi Roote,


Just wondered if you might be able to help again…..


I've been busily adding exclusions using tmutil as you suggest…. However, I think I may be hitting a limit and I wondered if you had any advice….


I tried adding all the files in one go similar to: $tmutil add exclusion /<volume>/<path>/*/*/*.NEF but it failed with the rather unhelpful error: Insufficient privileges to change exclusion setting.


I assumed the command has hit a limit when resolving all the path/file names so started again and added the exclusions one level down (by year)

i.e. $tmutil add exclusion /<volume>/<path>/2006/*/*.NEF


This worked for a while but the number of allowed files seems to be reducing such that I have been adding the 2012 photos by month and then single date.


I have now reached 1313 excluded files and only seem to be able to add new files a few at a time now. If I try to add more than a few, I get the above error again… I have another 3000 files to exclude currently and can't add them one by one!


Just wondered if you had any ideas..? Am I hitting a limit (although 1313 seems a bit of an odd number…)?


Thanks, KAren


P.S.

I can't change my directory structure as this is defined in the software I use….

Jul 16, 2015 7:59 PM in response to KEP27

Hi Karen,


I've never run into the problem you describe. I'm unaware of any exclusion limit. If you have Spotlight turned off for the volume that is triggering the error message when trying to exclude items, try turning Spotlight on and letting it finish it's indexing and then try excluding again. The other thing you might try is seeing if you run into the same problem excluding items from the Time Machine pane in System Preferences.

Jul 17, 2015 4:40 PM in response to Roote

Hi Roote,


I'm sorry to bother you again - but just wondered if you could help once more…..


I have found the issue… The error message was telling the truth and I was misled….


I have now successfully added nearly 6000 files to the exclusion list. (I've yet to test the back up though…)


There were just three files I couldn't add and I think this is down to file privileges.

The three files I couldn't add were rwxrwxrwx and all the other files were rwxrwxrwx@


Do you know what the '@' means? I am familiar with file permissions in HP-UX and Linux but have never seen this before...

Do you know if you can add this with chmod…?


Thanks, Karen

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is there any way to exclude specific file types from Time Machine backups?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.