Suppose I want to sync the contents of a directory (
source_dir
) using rsync
without creating a directory named source_dir
in the target directory.
I can do this using rsync source_dir/ target_dir
or rsync source_dir/* target_dir
.
Is the following correct?
The former will sync everything, including hidden files and source_dir/.
.
Using the latter the shell will expand the *
to every every non-hidden file in source_dir
and thus every non-hidden file in source_dir
will be synced.
(I'm asking mainly to check my understanding, but the XY problem behind this is that rsync -t source_dir/ target_dir
tries to set the time and I want to avoid that without using -O
.)
Asked by jdoe
(63 rep)
Jul 7, 2025, 06:12 AM
Last activity: Jul 7, 2025, 09:17 PM
Last activity: Jul 7, 2025, 09:17 PM