I use the DockSend feature of Transmit (a Mac FTP client) to mirror local files to the server, so I whipped up a little script to automatically send the current file to Transmit after a save.
Sometimes I work without a connection and don't want Transmit to start throwing errors, so the script first checks to see if I have Transmit running.
I keep all my mirrored projects in a specific folder, so it also checks if the file is inside that folder. You'd have to change this value to suit your needs, and you could also remove the checks if you wanted. You could also, of course, change Transmit to Interarchy or any other client with similar functionality.
It uses AppleScript so it's Mac-only.
This is my first time using Python, so forgive any sloppy coding.
Just past the code into a file called send_to_transmit.py and save it to Packages/User/
import sublime, sublime_plugin
def on_post_save(self, view):
cmd = "ps ax | grep -v grep | grep Transmit"
if os.system(cmd) == 0:
if view.file_name().count('/Users/dmatarazzo/Mirrors/') > 0:
cmd = """osascript -e 'tell app "Transmit" to open POSIX file """ + '"' + view.file_name() + '"' + "'"
print "Sent file to Transmit"