Path: csiph.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!bofh.it!news.nic.it!robomod From: Richard Hector Newsgroups: linux.debian.user Subject: Re: copy directory tree, mapping to new owners Date: Mon, 13 Sep 2021 01:50:02 +0200 Message-ID: References: X-Mailbox-Line: From debian-user-request@lists.debian.org Sun Sep 12 23:48:38 2021 Old-Return-Path: X-Amavis-Spam-Status: No, score=-8.175 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DIGITS_LETTERS=1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LDO_WHITELIST=-5, NICE_REPLY_A=-1.975] autolearn=ham autolearn_force=no X-Policyd-Weight: using cached result; rate: -4.6 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Mailing-List: archive/latest/780646 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/062f572d-46cc-b1bf-33c1-1c8cef614d09@walnut.gen.nz Approved: robomod@news.nic.it Lines: 32 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Mon, 13 Sep 2021 11:48:24 +1200 X-Original-Message-ID: <062f572d-46cc-b1bf-33c1-1c8cef614d09@walnut.gen.nz> X-Original-References: Xref: csiph.com linux.debian.user:239935 On 12/09/21 6:53 pm, l0f4r0@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