// Install rsync
sudo apt-get install rsync
// Run this everytime the source directory here: dir1 is changed
rsync -av --progress --delete dir1/ dir2
// for instance:
sudo rsync -av --progress --delete frontend/build/ /var/www/html
// FYI Unison seems to be another popular alternative
"https://www.cis.upenn.edu/~bcpierce/unison/"