How does rsync synchronize hidden and excluded files?
The basic writing of rsync Synchronization command
?
1 |
rsync command Options source directory target directory |
If the source directory is written as/var/www/, all files in the directory are synchronized to the target directory, and if written as/var/www/*, the hidden files in the current directory (the folder name or filename is "."). Sign) is not synchronized, but the hidden files in the subdirectory are still synchronized.
Suppose you need to exclude a file (or folder), you can specify it with –exclude, such as the need to exclude the Dir1 folder under the source directory, which can be written as:
?
1 |
/usr/bin/rsync-vzrtopg–exclude=dir1/var/www/src//var/www/dest |
You can exclude multiple bars at the same time, for example:
?
1 |
/usr/bin/rsync-vzrtopg–exclude=dir1–exclude=dir2/var/www/src//var/www/dest |
In addition to the above methods, you can also specify by –exclude-from, for example:
?
1 |
/usr/bin/rsync-vzrtopg–exclude-from=exclude.list/var/www/src//var/www/dest |
In the Exclude.list file, specify the list you want to exclude, for example:
?
1 2 3 4 |
Dir1 [0-9]* dir2/. [a-z0-9]*. SVN |
The implication is to exclude all the. SVN folders in the/var/www/dir1,/var/www directory, and all the files and folders that are digitally named,/var/www/dir2/directories, and/var/www directories, including the. svn folder in their subdirectories.
Note: There are two minus signs in front of exclude and exclude-from, and if one is omitted, the command line does not report an error, but the executed file or folder cannot be excluded.