The application of the --exclude parameter in the rsync command

The specific explanation of the rsync parameter is as follows:
--exclude=PATTERN Specifies to exclude files that do not need to be transferred.
Examples:
There are currently three directories a, b, and c under the directory test
[]#ls test
a bc

Copy the directory test, but do not copy the a directory, and copy it to test-2021.
[]# rsync -av --exclude=test/a test test-2021
sending incremental file list
created directory test-2021
test/
test/b/
test/c/

sent 110 bytes received 84 bytes 129.33 bytes/sec
total size is 0 speedup is 0.00

If I do not want to create a test under test-2021-2, but the parameter exclude parameter is found to be invalid at this time, and all the directories are copied. At this time, the parameter exclude needs to be placed after test-2021-2 (post-copy processing). The directory is a
[]# rsync -av --exclude=test/a test/* test-2021-2
sending incremental file list
created directory test-2021-2
a/
b/
c/

sent 100 bytes received 83 bytes 366.00 bytes/sec
total size is 0 speedup is 0.00

At this time, you need to put the parameter exclude after test-2021-2 (processing after copying). At this time, the directory is a.
Note: The parameter location and directory have changed
[]# rsync -av test/* test-2021-3 - exclude=a
sending incremental file list
created directory test-2021-3
b/
c/

sent 78 bytes received 79 bytes 314.00 bytes/sec
total size is 0 speedup is 0.00

parameter:

1 -v, --verbose Verbose output mode
2 -q, --quiet Simplified output mode
3 -c, --checksum Turn on the checksum switch to force the file transfer to be checked
4 -a, --archive Archive mode, which means Transfer files recursively, and keep all file attributes, equal to -rlptgoD
5 -r, --recursive Recursively process subdirectories
6 -R, --relative Use relative path information
7 -b, --backup to create a backup, That is, when the same file name already exists for the destination, rename the old file to ~filename. You can use the --suffix option to specify a different backup file prefix.
8 --backup-dir Store the backup file (such as ~filename) in the directory.
9 -suffix=SUFFIX Define the backup file prefix
10 -u, --update Only update, that is, skip all files that already exist in DST and the file time is later than the backup file. (Do not overwrite updated files)
11 -l, --links keep soft links
12 -L, --copy-links want to treat soft links like regular files
13 --copy-unsafe-links only copy points to SRC path directory Links outside the tree
14 --safe-links Ignore links that point to the SRC path outside the directory tree
15 -H, --hard-links Keep hard links
16 -p, --perms Keep file permissions
17 -o, - owner keep file owner information
18 -g, --group keep file ownership group information
19 -D, --devices Keep device file information
20 -t, --times Keep file time information
21 -S, --sparse Special processing for sparse files to save DST space
22 -n, --dry-run Which files will be transferred
23 -W, --whole-file Copy files without incremental checking
24 -x, --one-file-system Do not cross the file system boundary
25 -B, --block-size=SIZE check The block size used by the algorithm, the default is 700 bytes.
26 -e, --rsh=COMMAND specifies the use of rsh and ssh for data synchronization
27 --rsync-path=PATH specifies the path information of the rsync command on the remote server
28 -C , --cvs-exclude Use the same method as CVS to automatically ignore files to exclude those files that you don't want to transfer
29 --existing Only update those files that already exist in DST without backing up those newly created files
30 - delete delete those files that are not in the SRC in the DST
31 --delete-excluded also delete the files on the receiving end that are excluded by this option
32 --delete-after delete after the end of the transmission
33 --ignore-errors also proceed when IO errors occur Delete
34 --max-delete=NUM delete at most NUM files
35 --partial keep those files that are not completely transferred for some reason, so as to speed up the subsequent transfer
36 --force force delete the directory, even if it is not empty
37 --numeric-ids Do not match numeric user and group IDs to user and group names
38 --timeout=TIME IP timeout time, in seconds
39 -I, --ignore-times Do not skip those with the same time And the length of the file
40 --size-only When deciding whether to back up the file, only check the file size without considering the file time
41 --modify-window=NUM The timestamp window used when deciding whether the file has the same time, the default is 0
42 -T --temp-dir=DIR Create a temporary file in DIR
43 --compare-dest=DIR also compare files in DIR to determine whether you need to back up
44 -P is equivalent to --partial
45 --progress Display the backup process
46 -z, --compress Compress the backed-up files during transmission
47 --exclude=PATTERN Specify the pattern to exclude files
that do not need to be transmitted 48 --include=PATTERN Specify the pattern of files that need to be transmitted without excluding
49 --exclude -from=FILE Exclude files with the specified pattern in FILE
50 --include-from=FILE Do not exclude files matching the FILE specified pattern
51 --version Print version information
52 --address Bind to a specific address
53 --config=FILE Specify other configuration files, do not use the default rsyncd.conf file
54 --port=PORT Specify other rsync service ports
55 --blocking-io Use blocking IO for remote shell
56 -stats gives the transmission status of certain files
57 --progress shows the transmission process during transmission
58 --log-format=formAT specifies the log file format
59 --password- file=FILE Get the password from FILE
60 --bwlimit=KBPS Limit I/O bandwidth, KBytes per second
61 -h, --help Display help information

Guess you like

Origin blog.51cto.com/14036860/2609268