Skip to main content
Became Hot Network Question
edited title
Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

`rsync`: trailing slackslash vs wildcard

Source Link
jdoe
  • 63
  • 3

`rsync`: trailing slack vs wildcard

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.)