Use Cyberduck CLI with fswatch

With Cyberduck CLI there are many new ways automate tasks that require to transfer files to a remote server with duck.. We have added a section to our wiki to show use cases.

One such is making use of fswatch, a file change monitor that receives notifications when the contents of the specified files or directories are modified. Used together with Cyberduck CLI, you can keep a remote directory in sync with local changes.

fswatch -0 ~/Sites/mywebsite/ | xargs -0 -I {} -t sh -c 'f="{}"; duck --upload ftps:///sandbox`basename "${f}"` "${f}" -existing overwrite'

The command will make fswatch listen for changes in directory ~/Sites/mywebsite/ and upload any changed file into the remote folder ftps:///sandbox using a FTP-TLS connection overwriting any existing files.