-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsync.cheat
29 lines (21 loc) · 942 Bytes
/
rsync.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% rsync
; -z compress file data
; -r copy recursively
; -a archive mode (copy recursively and preserve lynks, permissions, user, group, timestamps)
; -e protocol to use
; -n dry run
; -u skip files that are newer on the receiver
; -c skip files based on checksum
# Copy file locally
rsync --progress -zvh <file> <dest_dir>/
# Copy directory locally
rsync --progress -avzh <src_dir>/ <dest_dir>/
# Copy directory recursively to remote with SSH
rsync --progress -avzh -e 'ssh -p 22' <src_dir>/ <remote>:<remote_dir>/
# Copy directory recursively to remote with SSH
rsync --progress -avzh -e 'ssh -p 22' <remote>:<remote_dir>/ <dest_dir>/
# Copy files with specific extension
rsync -rv --include '*/' --include '*.<ext>' --exclude '*' --prune-empty-dirs <src_dir>/ <dest_dir>/
# Synchronize 2 directories and skip files newer on destination or with same checksum
rsync -rtvuc <src_dir>/ <dest_dir>/
$ src_dir: find . -maxdepth 1 -type d