OSDN Git Service

Regular updates
[twpd/master.git] / rsync.md
1 ---
2 title: Rsync
3 category: CLI
4 layout: 2017/sheet
5 weight: -1
6 ---
7
8 ### Basic example
9 {: .-prime}
10
11 ```bash
12 # syncing folder src into dest:
13 rsync -avz ./src /dest
14 # syncing the content of src into dest:
15 rsync -avz ./src/ /dest
16 ```
17
18 ### OSX
19
20 ```bash
21 --exclude '.Trashes'
22 --exclude '.Spotlight-V100'
23 --exclude '.fseventsd'
24 ```
25
26 ### Transfer options
27
28 ```bash
29 -z, --compress
30 -n, --dry-run
31     --partial   # allows resuming of aborted syncs
32     --bwlimit=RATE    # limit socket I/O bandwidth
33 ```
34
35 ### Display options
36
37 ```bash
38 -q, --quiet
39 -v, --verbose
40     --stats
41 -h, --human-readable
42     --progress
43 -P                     # same as --partial --progress
44 ```
45
46 ### Skipping options
47
48 ```bash
49 -u, --update     # skip files newer on dest
50 -c, --checksum   # skip based on checksum, not mod-time & size
51 ```
52
53 ### Backup options
54
55 ```bash
56 -b, --backup           # backup with suffix
57     --suffix=SUFFIX    # default ~ without --backup-dir
58     --backup-dir=DIR
59 ```
60
61 ### Include options
62
63 ```bash
64 --exclude=PATTERN
65 --include=PATTERN
66 ```
67
68 ```bash
69 --exclude-from=FILE
70 --include-from=FILE
71 --files-from=FILE    # read list of filenames from FILE
72 ```
73
74 ```bash
75 -C, --cvs-exclude    # exclude from local/global .cvsignore
76 ```
77
78 ### Archive options
79
80 ```bash
81 -a, --archive    # archive (-rlptgoD)
82 ```
83
84 ```bash
85 -r, --recursive
86 -l, --links      # copy symlinks as links
87 -p, --perms      # preserve permissions
88 -t, --times      # preserve times
89 -g, --group      # preserve group
90 -o, --owner      # preserve owner
91 -D               # same as --devices --specials
92 ```
93
94 ```bash
95 --delete         # Delete extra files
96 ```