Would you like to write your own script, you may want to use a shell script ( i.e. UNIX commands ). Indeed, since these scripts can be easily given additional privileges for a limited period of time, they will better interact with Mac OS X when it comes to working with essential system files.

Would you be an experienced AppleScripter, keep in mind that shell script commands can be included in an AppleScript.