coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mv --recursive


From: Kaz Kylheku (Coreutils)
Subject: Re: mv --recursive
Date: Fri, 01 Jun 2018 12:56:34 -0700
User-agent: Roundcube Webmail/0.9.2

On 2018-06-01 04:08, Grady Martin wrote:
Hello.  I have two questions:

· Is there a way to recursively merge two directories with move (not
copy/delete) operations, using standard GNU utilities?
· If not, how do coreutils' maintainers feel about an
-r/-R/--recursive patch for mv?

We can almost do this already, with cp, except that the files also remain a the source.

■ mv -R old new
■ ls -R

I.e.

cp -rl old/. new/.

The new/ tree is populated with hard links to corresponding objects in old, which is what mv will do (on the same filesystem, anyway).

Basically, if cp had an option called "--remove-source", which does what its name says, I think it would do what you want.

cp itself could optimize using hard linking when that option is specified, and the source and destination directories are on the same filesystem, which supports linking.

cp with --remove-source would just about obsolesce mv.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]