/ linux

rsync

A nice way to sync folders, even local, is the tool rsync.
I use this to sync my nginx data folder with a git-enabled folder:
sudo rsync -rtv --files-from=rsync_include.txt /etc/nginx/ /home/pi/nginx-reverse-conf/

To keep the amount of transfered files at minimum I make use of the include function instead of excluding some files.

  • -r -- Recursive
  • -t -- Keep timestamp
  • -v -- Verbose mode on
  • --files-from='' -- What files to include
  • --dry-run -- is a good option upfront to simulate the execution to see what would be synced.