Rsync: basic syntax of the synchronization command rsync command option: the target Directory of the source directory. if the source directory is/var/www/, all files in the directory will be synchronized to the target directory, if it is written as/var/www/*, the hidden file in the current directory (the folder name or file name is ". but the hidden files in the subdirectories will still be synchronized. Suppose you want to exclude a file (or folder), can you use? Exclude. for example, to exclude the dir1 folder under the source directory, you can write it to/us.
Basic rsync command syntax
Rsync command option source directory target Directory
If the source directory is/var/www/, all the files in the directory will be synchronized to the target directory. if it is/var/www /*, the hidden file in the current directory (the folder name or file name is ". but the hidden files in the subdirectories will still be synchronized.
If you want to exclude a file (or folder), you can use? ExcludeFor example, to exclude the dir1 folder under the source directory, you can write it:
/Usr/bin/rsync-vzrtopg? Exclude = dir1/var/www/src // var/www/dest
Multiple entries can be excluded at the same time, for example:
/Usr/bin/rsync-vzrtopg? Exclude = dir1? Exclude = dir2/var/www/src // var/www/dest
In addition to the above method, you can also use? Exclude-fromFor example:
/Usr/bin/rsync-vzrtopg? Exclude-from = exclude. list/var/www/src // var/www/dest
The exclude. list file specifies the list to be excluded, for example:
Dir1
[0-9] *
Dir2/. [a-z0-9] *
. Svn
It means to exclude all files and folders named by numbers in the/var/www/dir1,/var/www Directory, hidden files under the/var/www/dir2/directory, and/ var/www Directory all. svn folder, including. svn folder.
Note:Both exclude and exclude-from have two minus signs. if one is missing, the command line will not report an error, but the executed files or folders cannot be excluded.