Watch a file for changes and copy/sync it to a remote host


  • works on Linux and Mac OS
  • install entr
ls -b [file]... | entr -p scp /_ targethost:/destination/folder/


  • works only on Linux
  • it does not work if the file is replaced rather than changed.
  • install inotify-tools
F="filename" eval 'inotifywait -m -e close_write $F | while read E; do echo -e $(date +"%F %T") $E; scp $F root@targethost:/destination/folder/; done;'