Follow these steps to synchronize files with Rsync:
Step 1 : Create a sample directory structure on the source server
Step 2 : Now, use the following command to synchronize the entire directory from the source server to your local system.
As this is the first time, all files from sampledir on the remote server will be downloaded in a backup directory on your local system.
Step 3 : You can check the downloaded files with the ls command:
Step 4 : Add one new file on the remote server under sampledir
Step 5 : Now re-execute the rsync command on the destination server. This time, rsync will only download a new file and any other update files.
Step 6 : To synchronize two local directories, you can simply specify the source and destination path with rsync, as follows:
Step 7 : Use the following command to push files to the remote server: