TL Mieszkowski <t...@ftfa.us> 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. _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils