Rsync for NAS beginner
rsync -ahvP [-c] [-m] [-W] [-n] [--remove-source-files] [--log-file=FILE] src dest
use sudo to keep file ownership!
- -a : archive mode; equals -rlptgoD (no -H,-A,-X)
- -h : output numbers in a human-readable format
- -v : increase verbosity
- -P : same as --partial --progress
- --partial : keep partially transferred files
- --progress : show progress during transfer
- -c : skip based on checksum, not mod-time & size
- -m : prune empty directory chains from file-list
- -W : copy files whole (w/o delta-xfer algorithm)
- -n : perform a trial run with no changes made (dry-run)
- --remove-source-files : sender removes synchronized files (non-dir)
- --log-file=FILE : log what we're doing to the specified FILE
archive mode handles recursion, file ownership, permission and so on...
- -r : recurse into directories
- -l : copy symlinks as symlinks
- -p : preserve permissions
- -t : preserve modification times
- -g : preserve group
- -o : preserve owner (super-user only)
- -D : same as --devices --specials
- --devices : preserve device files (super-user only)
- --specials : preserve special files
archive mode does not handles
- -H : preserve hard links
- -A : preserve ACLs (implies -p)
- -X : preserve extended attributes
find . -depth -type d -empty -delete
prunes empty subdirectories (useful with --remove-source-files)