delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/10/22/10:51:28

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CBD83858C62
Authentication-Results: sourceware.org;
dmarc=pass (p=none dis=none) header.from=yandex.ru
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
t=1666450202; bh=+z8hIqjaoVpoNiWEIZm08fFBzJBBI26Qf39jadJUEoc=;
h=In-Reply-To:Subject:Date:References:To:Message-ID:Reply-To:From;
b=S+GbCpES09eIsNmYrjnKzufHV6FoSjMGHt7SNVeib5bkca+FZIiX7+f5lw4d7iDWr
Qw34CHMINDkkFI6dl3V1CinmhyYMR2X0Y4n7TjZTIrqmkryhTaHEwre1HXdE8L+ElS
rswt5qxsB6vSjSt2we6t6F1OpkmFFwFNKUDYjYOA=
Authentication-Results: vla3-aeadfdeff55e.qloud-c.yandex.net;
dkim=pass header.i=@yandex.ru
Date: Sat, 22 Oct 2022 17:39:19 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <3910040698.20221022173919@yandex.ru>
To: Fergus Daly <fergusd84 AT outlook DOT com>, cygwin AT cygwin DOT com
Subject: Re: When only rsync will do .. or maybe not
In-Reply-To: <DB6P18901MB0055D8029AD580DE9D4AB12FA4229@DB6P18901MB0055.EURP189.PROD.OUTLOOK.COM>
References: <DB6P18901MB0055D8029AD580DE9D4AB12FA4229 AT DB6P18901MB0055 DOT EURP189 DOT PROD DOT OUTLOOK DOT COM>
MIME-Version: 1.0
X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT,
NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

Greetings, Fergus Daly!

> Requirement: to move some selected files and folders under /folder1/ to /folder2/, preserving full pathnames.

Full pathname would include the /folder1 making the requirement impossible
from the start.
If, on the other hand, you want to preserve directory structure, then a simple

    cd /f1; find . -xdev -type d -exec mkdir -p "/f2/{}" ';' -o -type f -exec mv '{}' "/f2/{}" ';'

will do.

> One solution would be (i) to copy the required content to /folder2/ and
> then (ii) delete the identical content under /folder1/;
> but this is expensive (one might not even have the disk space to do it) and
> it seems seriously unsatisfactory and not without risk
> to have to copy folders and files (possibly huge) when all one wants to do is to change the {pathname} to them.

`cp --reflink=always` will take care of duplicated content.
Do note that paths must be relative. cp has an issue detecting "same volume"
and failing or falling back to simple copy.

> Question 1
> Would the command (or something like it, again with care over syntax and $PWD)
> $ rsync -axuv --progress {pathto}/folder1/{content} {pathto}/folder2/   
> do the trick? Or is the very existence of the switch
> $ rsync -axuv --remove-source-files --progress {pathto}/folder1/{content} {pathto}/folder2/
> indicative that here too the "move" is achieved through a two-stage "copy-then-delete" operation?

> Question 2
> If rsync can provide a genuine "move" capability then is installing the
> rsync package adequate to the purpose;
> or would librsync-devel and/or librsync2 packages need to be installed also?

No, not the purpose of rsync.

> Question 3
> If not rsync, is there any operation for which "move" can be achieved
> without involving "copy-then-delete"? 

Yep.
See above.


-- 
With best regards,
Andrey Repin
Saturday, October 22, 2022 11:56:05

Sorry for my terrible english...


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019