bug-coreutils
[Top][All Lists]
Advanced

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

Re: mv feature request: -z swap files


From: Jim Meyering
Subject: Re: mv feature request: -z swap files
Date: Tue, 03 Feb 2009 09:26:03 +0100

TL Mieszkowski <address@hidden> wrote:
> I've needed to swap two filenames more than once,
> but no UNIX program I can find does it.
>
> The patch I've included works on two regular files,
> one regular file and a directory, but if you provide two
> directories or 1 directory first it trashes the first directory.
> I think this is due the vagaries of the
> rename function, but I can't understand why it happens.
> It says it can't copy a directory into itself, but the target
> doesn't even exist.
>
> There may also be issues across filesystems, since
> it uses the /tmp directory? Is there a way to do it without
> a /tmp? Is it possible to do it right, without just calling
> mv? Is this workable at all?

Thank you for the patch, but this functionality does not belong in mv.

However, a program that does that -- and does it robustly and
efficiently -- would be a useful addition to coreutils.
Note that it must be safe to run e.g., "cd /tmp && exch FILE1 FILE2",
assuming the new tool is called "exch".

I don't want to dictate the language (or maybe I do ;-), but at
least initially it should be a script, probably written in Perl.
I'm considering maintaining a contrib/ directory in coreutils,
and if someone already has such a script, I'd consider adding it.




reply via email to

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