On Thu, Dec 30, 2021 at 12:15 AM Dan Stromberg <drsalists(a)gmail.com> wrote:
FWIW: in the old days, I just used tar cf - . | (cd some_place_else; tar
xvpf - )
preserving permissions.
In the new days, rsync -a dir1/ dir2 is the ticket (derived from "is
etiquette", if you can believe it). You need the terminating slash to
prevent dir1 from becoming a subdirectory of dir2; dir1/* would of course
not copy dotfiles. (I grew weary of typing "cp -r dir1/.[a-zA-Z]* dir2" to
copy dotfiles and dotdirectories left behind.) The -a flag ensures
permissions, symlinks, etc. are preserved.
If you rsync more than once, only the files in dir1 that have changed are
copied. You can also use user@host:path as either argument to make it
work over ssh, which is the common use case.