Steve Yeoman
Steve Yeoman

Reputation: 86

Is there a way to automatically upload changed files to a server

Is there a Unix command, or set of commands, which will set up a watch on a local folder and automatically upload changed files to a web server. I use Sublime with SFTP at home which does this beautifully, but at work I can't install Sublime although I can SSH, FTP etc with Terminal on their Mac.

Upvotes: 0

Views: 1474

Answers (2)

miku
miku

Reputation: 188014

entr runs arbitrary commands when files change.

It can be installed on Mac OS X via homebrew

$ brew install entr

Example:

$ find /path/to/my/repo | entr echo "Something changed"

Just substitute echo "Something changed" with your FTP uploader of choice.

The syntax for lftp would be something like this:

$ lftp -e "mirror -R {local dir} {remote dir}" -u {username},{password} {host}

Upvotes: 1

ChatterOne
ChatterOne

Reputation: 3541

Have a look at rsync over FTP from here http://www.cyberciti.biz/faq/howto-linux-unix-bsd-appleosx-using-rsync-with-ftp-server/

Upvotes: 1

Related Questions