Back to Mobile View

Skip to Content

Terminal Tip: Find out which files won't be backed up

Backing up is one of the most important things you can do on a Mac, and thankfully, it's a pretty trivial affair with Time Machine built right in. Of course, when you're looking at what needs backing up, people often overlook what doesn't need backing up (or isn't, but should be).

A good example of this would be a rented media file, like a TV show rented from iTunes. It's only valid for 48 hours, so even if you do back it up, by the time you've restored your machine after a system failure, it's unlikely to play anyway. In essence, it's wasted space.

Thankfully, OS X has a built-in system of defining what should and shouldn't be backed up using metadata, and for the most part, it happens under your nose without you even noticing. There are times when it would be useful to see what's marked for backup and what's not, however, and that's where we turn to Terminal.

Simply fire up Terminal, and enter this:

sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"

Type in your password, and it'll tell Spotlight to find anything marked with com_apple_backup_excludeItem, which is the 'do not back me up' indicator.

If you happen to spot something you think should be backed up, but is marked as excluded, you can remove the metadata tag with:

xattr -d com.apple.metadata:com_apple_backup_excludeItem yourfilenamehere

Where 'yourfilenamehere' should be replaced with the name and extension of the file you want to remove the 'do not backup' flag from. If you're using Time Machine, be aware that some (often pretty large) files, like virtual memory caches, will get backed up over and over again if deflagged, taking up vast amounts of space on any backup drives.

© 2014 AOL Inc. All Rights Reserved.