To exclude files/folders from a Time Machine backup, you can use the C-function CSBackupSetItemExcluded()
.
As far as I know there isn’t an official way to do this from the command-line or a shell script. As near as I can tell, the safest way to it without using compiled C-code is:
sudo defaults write /Library/Preferences/com.apple.TimeMachine \
SkipPaths -array-add "PATH-ONE" "PATH-TWO"
where "PATH-ONE" "PATH-TWO"
are of course paths to items you want to exclude.
Credit to Ellis Jordan Bojar for this solution. (original article) Using defaults
instead of tinkering with .plist files directly is really the way to go!