"rsync" Command Line is used for the synchronization of files as well as directories across two different types of file systems. This can also be used for copying over only the newer files which are not already present at the other side. More about the Useful Command Line is detailed in the following text. All these details that are shown in the following text are about Copying files to a Remote Server or Computer from the Local Computer.
Default Behavior :
The command shown above will copy all files to the Remote System at 10.1.1.1 from the Local System from /var/www recursively. By using this command :-
1. Files not existing on the Remote System will be Copied.
2. If part of a file is changed then the updated file will be copied (only the changed parts).
3. Anything deleted on the local system will also be deleted on the remote system.
Ignore Existing Files :
If you want to ignore the files that exist on the remote server then you should use --ignore-existing flag in the command line. By using this flag the things details in the 2 and 3 part of Default Behavior will be eliminated.
Update the Remote if Newer Version is Available on the Local Filesystem :
If you don't want to overwrite any files at the server end but need to copy files that have been updated recently on the Local Filesystem then you should use the --update flag in the command line. By Using this flag in command line :-
1. Files not existing on the Remote System will be Copied.
2. Files existing on both sides but having newer timestamp on the local system will be copied on remote system (files having older timestamp at local system will not be copied).
See What will be Copied :
Using the command line shown above will allow the user to see all the files and directories that will be copied from Local System to Remote System.
Default Behavior :
Code:
rsync -raz --progress /var/www 10.1.1.1:/var
1. Files not existing on the Remote System will be Copied.
2. If part of a file is changed then the updated file will be copied (only the changed parts).
3. Anything deleted on the local system will also be deleted on the remote system.
Ignore Existing Files :
Code:
rsync --ignore-existing -raz --progress /var/www 10.1.1.1:/var
Update the Remote if Newer Version is Available on the Local Filesystem :
Code:
rsync --update -raz --progress /var/www 10.1.1.1:/var
1. Files not existing on the Remote System will be Copied.
2. Files existing on both sides but having newer timestamp on the local system will be copied on remote system (files having older timestamp at local system will not be copied).
See What will be Copied :
Code:
rsync --dry-run --update -raz --progress /var/www 10.1.1.1:/var