On Sat, 15 Apr 2023, Russell Senior wrote:

You probably want the -H option too, to preserve hardlinks.

Russell,

Okay. I wondered about that and about -r for recursive, but I think that the
-a archive option does recursion.

Also, my lizard brain is telling me you want trailing slashes too. I'll
take Michael's suggestion about -z as given without further research and
suggest:
  rsync -v -a -H /media/bkup1/ /media/bkup2/

I also suggest reading "man rsync" to confirm. In a cronjob, the -v maybe isn't needed.

I did read 'man rsync' again before writing. The man page says that the
closing / is not needed on the source and, if used on the destination it
creates the src directory in the destination directory:

rsync -avz foo:src/bar /data/tmp

This would recursively transfer all files from the directory src/bar on the
machine foo into the /data/tmp/bar directory on the local machine. The files
are transferred in archive mode, which ensures that symbolic links, devices,
attributes, permissions, ownerships, etc. are preserved in the transfer.
Additionally, compression will be used to reduce the size of data portions
of the transfer.

rsync -avz foo:src/bar/ /data/tmp

A  trailing  slash  on  the source changes this behavior to avoid creating
an additional directory level at the destination.

What I need are all subdirectories in the source (/media/bkup1/) copied into
the destination directory (/media/bkup2/). Apparently, using a final / on
the src directory only is equivalent to leaving it off both src and dest.

Thanks,

Rich

Reply via email to