Are there any OSX tools that can watch for file changes in a directory then sync (SFTP) those changes to a remote server?

Basically I want to edit files locally (whatever files, whatever program) and have them automatically upload to the server.

Rsync can't watch a directory for changes on it's own, and I can't seem to get lyncd to run on osx, due to no inotify tool.

Any ideas?


Solution 1:

I'm only aware of proprietary systems like DropBox.

But it seems like this could be done fairly easily, using kqueue to detect file changes, and running rsync a few seconds later.

Solution 2:

RE : ".. Basically I want to edit files locally (whatever files, whatever program) and have them automatically upload to the server."

You're in luck, DoubleDown will do exactly what you specified :

Direct Download for DoubleDown here.

DoubleDown download page with more info here.

More info on DoubleDown :

Doubledown keeps a complete local copy of the remote directory you're syncing so all your local operations are lightning fast. After it performs an initial sync (being careful not to clobber any local changes), Doubledown is notified of changes by Mac OS X's FSEvents framework and responds by creating, uploading, and removing files or directories as required.

Hope this helps.

Solution 3:

If you are happy writing a script, Folder Actions let you achieve what you require:

http://www.simplehelp.net/2007/01/30/folder-actions-for-os-x-explained-with-real-world-examples/

The following page seems to offer exactly the solution you are looking for:

http://sites.google.com/site/andreatagliasacchi/blog/osxautomaticsyncwithfolderactions

Solution 4:

Here's an article about doing just that with a Ruby script.

It uses FSEvent, the inotify counterpart on Mac OS X.

Solution 5:

Use entr command-line tool to watch for file changes in a directory. It has special -d option to react to events when a new file is added to a directory. The implication is that if a new file appears it must exit to allow an external shell loop to rescan the file system, so when -d is used, you've to use it with a loop. For example (to check for changes in path/ directory):

$ while true; do
> find path/ | entr -d sh -c 'rsync -vuar path/ example.com:. && echo Updated'
> done

Installation via Brew: brew install entr.