I know you can use -a
or --archive
to activate archive mode when using rsync. Unfortunately, I have no idea what archive mode is supposed to do, and the man page is not at all explicit about what this is:
equals -rlptgoD (no -H,-A,-X)
Can you explain what those options (rlptgoD
) mean and what's the behaviour of rsync when I use them?
It's all of these:
It excludes:
It's perfect for backups. My "default" set of switches is
-avzP
- archive mode, be verbose, use compression, preserve partial files, display progress.Note: Invariably when the descriptions say "preserve", it means make the destination be like the source.
It make sure the permission, attributes, etc. is same at the both side. rsync only works in that way... if you want to synchronising files, you have to use -a parameter.
This is because rsync compare these permission, attribute, etc. at both side to determining if they are the SAME FILE and decide if it should be updated. if you use rsync -r xxx yyy instead rsync -a xxx yyy, some files will be copy again and again, coz, permission, attribute not be synchronised, and miss matched at both side...
The archive switch is just a shortcut to skip having to enter a bunch of switches that you'll normally use if you're using rsync to make backups (a common task).
It's the same as typing:
And it's much easier to remember. You can find definitions for all of those switches in the man page.
(The hyphens are optional when you're combining multiple single-letter switches.)