Description
You can only exclude upload files/directories using Rsync-av--exclude=upload/home/mysql/backup/home/mysql/backup2/. However, if you want to exclude multiple files/directories, you need to create a new exclude.list and then Rsync-av--exclude-from= "exclude.list" to specify files/directories that do not need to be synchronized
Realize:
The code is as follows |
Copy Code |
# Rsync-av--exclude-from=/root/exclude.list/home/mysql/backup/home/mysql/backup2/ Copy the/home/mysql/backup directory to the/home/mysql/backup2 directory,/root/exclude.list the specified file is not copied. |
Note Exclude.list fill in the File/directory to exclude, one line, directly to write the file name.
So if you want to rule out a,b.1,b.2,tmp/g, then exclude.list should write
The code is as follows |
Copy Code |
A b.* Tmp/g |
Instead of filling in the full URL below. Otherwise, this will still be synchronized a,b.1,b.2,tmp/g
The code is as follows |
Copy Code |
/home/mysql/backup/a /home/mysql/backup/b.* /home/mysql/backup/tmp/g |
Of course, the following writing is also synchronized a,b.1,b.2,tmp/g file, there are problems
The code is as follows |
Copy Code |
./home/mysql/backup/a ./home/mysql/backup/b.* ./home/mysql/backup/tmp/g |
Appendix:
code is as follows |
copy code |
--exclude= Pattern exclude files Matching pattern --exclude-from=file read exclude patterns from FILE --include=pattern don ' t Exclude files matching pattern --include-from=file read include patterns from FILE |