Scripting Timemachine exclusion lists

Is it possible to script the exclude lists for Time Machine when setting up a new machine?

For example, for a new machine I would like to setup the following exclusion list:

enter image description here


The tmutil command line tool, included with OS X, supports the ability to add and remove items from the exclusion list.

sudo tmutil addexclusion ~/.ivy2

See the tmutil manual page for more information about this tool's options.

As tmutil is a command line tool, it can be incorporated into AppleScripts using do shell script, combined with Automator workflows using the Run shell script step, or as part of a traditional shell script.