I was wondering if there is any way through applescript or automator in Mac OSX Mountain Lion to automatically copy a file or folder to a network drive after the file is saved/the folder is modified. I am trying to do this for a user who designs in Photoshop and has 2GB+ size files that take a long time to save to the network drive directly so I am trying to create a way where he can save locally and automatically have it copied over to the networked drive.
Using launchd, you could save a plist like this as ~/Library/LaunchAgents/rsync_folder.plist
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key>
<string>rsync_folder</string>
<key>ProgramArguments</key>
<array>
<string>bash</string>
<string>-c</string>
<string>[[ -e /Volumes/WD ]] && rsync -a ~/Notes /Volumes/WD</string>
</array>
<key>WatchPaths</key>
<array>
<string>~/Notes/</string>
</array>
</dict>
</plist>
Then load it with launchctl load ~/Library/LaunchAgents/rsync_folder.plist
or by logging out and back in.
Or create a rule like this in Hazel:
Neither watches for changes to files in subfolders (like ~/Notes/subfolder/file.txt) though.