On 12/09/21 6:53 pm, l0f...@tuta.io wrote:

# actually not necessary? rsync will create it
mkdir -p mysite_test/doc_root

You can make a simple test to know that but I would say that rsync doesn't create your 
destination "root" directory (the one you specify on the command line) unless 
`--mkpath` is used.

I was fairly confident of that, from my regular usage.

# The trailing / matters. Does it matter on the source as well?
# I generally include it.
rsync -a mysite/doc_root/ mysite_test/doc_root/      # The trailing / matters.

Actually, I'm not sure to understand Greg's remark here.

In my opinion, trailing slash doesn't matter for destination folder on the 
contrary of *source* folder.

In other words, for me, the following are equal:
rsync -a mysite/doc_root/ mysite_test/doc_root/
rsync -a mysite/doc_root/ mysite_test/doc_root

But not the following:
rsync -a mysite/doc_root mysite_test/doc_root => you will get an extra 
"doc_root" folder (the source one) in your dest, i.e. : 
mysite_test/doc_root/doc_root and then the content of doc_root source
rsync -a mysite/doc_root/ mysite_test/doc_root => your doc_root (destination) 
folder will get doc_root content (source) directly

Yep. As I've mentioned elsewhere, I habitually include trailing slashes for both source and destination when I'm replicating a whole tree. I couldn't remember the details of what happens when you don't, but I know what happens when I do :-)

Cheers,
Richard

Reply via email to