Using -r
or --recursive
causes rsync
to recurse into directories. -a
or --archive
equals -rlptgoD
, so -a
implies -r
.
If I have directories source/
and dest/
and I run:
rsync source dest
then rsync
skips source/
and does not copy anything. If I run:
rsync -a source dest
then -a
implies -r
and rsync
copies source/
and all of its contents to dest/
.
But if I have a file list.txt
that contains the line source
, and the full path of my directory source/
is /home/user/source/
, and I run:
rsync -a --files-from=list.txt /home/user/ dest
then rsync
only copies source/
to dest/
but does not copy its contents. The same happens if I run the command without the -a
option.
But if I run the same command with -r
:
rsync -r --files-from=list.txt /home/user/ dest
then rsync
copies source/
and all of its contents to dest/
.
My questions are:
- Why doesn't
-a
imply-r
when the--files-from=FILE
option is used? Is this expected behavior? - Given that the command
rsync source dest
skipssource/
and copies nothing becausesource/
is a directory and neither-a
nor-r
is used, why does the commandrsync --files-from=list.txt /home/user/ dest
still copysource/
todest/
? - Do the other options implied by
-a
still work when the--files-from=FILE
option is used? Is-r
the only option that is left out?
Edit: Looks like I should have read the man
page more thoroughly. Under the description of the --files-from=FILE
option it says:
The --archive (-a) option’s behavior does not imply --recursive (-r), so specify it explicitly, if you want it.
(Answers my first question.)
The --dirs (-d) option is implied, which will create directories specified in the list on the destination rather than noisily skipping them (use --no-dirs or --no-d if you want to turn that off).
(Answers my second question.)