GNU bug report logs - #5926
feature request: mv -p to create missing target dir

Previous Next

Package: coreutils;

Reported by: Rodolfo Borges <rodolfo.borges <at> gmail.com>

Date: Sun, 11 Apr 2010 14:10:02 UTC

Severity: wishlist

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 5926 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Rodolfo Borges <rodolfo.borges <at> gmail.com>
Cc: 5926 <at> debbugs.gnu.org
Subject: Re: bug#5926: feature request: mv -p to create missing target dir
Date: Thu, 15 Apr 2010 17:13:41 -0600
Rodolfo Borges wrote:
> $ mv foo ~/some/path/
> mv: cannot create regular file `/home/bart9h/some/path/': Is a directory

No target directory exists.

> $ mkdir -p ~/some/path/
> $ mv foo ~/some/path/

That seems like the best way to do it.

> $ :(
> bash: syntax error near unexpected token `newline'
> ...
> $ :)
> bash: syntax error near unexpected token `)'

Using this format to tell us what you are thinking is very confusing!

> $ mv -vp foo ~/some/path/
> mv: created directory `/home/bart9h/some'
> mv: created directory `/home/bart9h/some/path/'
> `foo' -> `/home/bart9h/some/path/foo'

I don't think this is a good idea.  It could be added.  But does it
really gain you anything over calling mkdir -p?  I don't think so.  It
would simply add code bloat to the program.

Plus it wouldn't be portable.  Other implementations wouldn't have it.
It is only of marginal benefit if at all and so other implementations
might never have it.  In any case you would need to wait years before
the feature trickled down to where you could use it reliably.  Also
you can always accomplish this yourself with a shell script.  In
general things that can be easily encapsulated in a shell script are
not good additions to the utilities.

Adding that option is counter to The Unix Philosophy.  Small is
beautiful.  Make each program do one thing well.  Choose portability
over efficiency.  Use shell scripts to increase leverage and
portability.

Bob




This bug report was last modified 10 years and 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.