rsync efficiently copies files between your server and a backup destination.
Basic Backup
rsync -avz /var/www/ /backup/www/Remote Backup
rsync -avz -e ssh /var/www/ backup@remote-server:/backups/www/Exclude Files
rsync -avz --exclude='*.log' --exclude='node_modules' /var/www/ /backup/www/Automated with Cron
crontab -e\n0 2 * * * rsync -avz --delete /var/www/ backup@remote:/backups/www/ >> /var/log/backup.log 2>&1Flags Explained
-aarchive mode (preserves permissions, timestamps)-vverbose-zcompress during transfer--deleteremove files at destination that no longer exist at source