coreutils
[Top][All Lists]
Advanced

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

Re: mv w/mkdir -p of destination


From: Bob Proulx
Subject: Re: mv w/mkdir -p of destination
Date: Fri, 17 Jul 2020 00:29:15 -0600

Vito Caputo wrote:
> Does this already exist?
> 
> Was just moving a .tgz into a deep path and realized I hadn't created
> it on that host, and lamented not knowing what convenient flag I could
> toss on the end of the typed command to make `mv` do the mkdir -p
> first for me.

I suggest using the command line shell for this.  For example:

  $ mv foo.tar.gz /home/rwp/one/two/three/four/five/six/seven/eight/nine/
  mv: cannot move 'foo.tar.gz' to 
'/home/rwp/one/two/three/four/five/six/seven/eight/nine/': No such file or 
directory
  $ mkdir -p ESC .
  $ Control-P Control-P Enter

Some users probably use ESC _ instead of ESC . as both are the same.
But ESC _ works in vi mode too.  Also $_ works but then it is not
WYSIWYG.  So I suggest vi mode users should use ESC _ for this.

  $ mv foo.tar.gz /home/rwp/one/two/three/four/five/six/seven/eight/nine/
  mv: cannot move 'foo.tar.gz' to 
'/home/rwp/one/two/three/four/five/six/seven/eight/nine/': No such file or 
directory
  $ mkdir -p ESC _
  $ ESC k ESC k Enter

This feature is so easy to use on the command line that I can't see a
need to add the feature to mv.  Using the command line shell is
already there and the ability to use it helps with all of the commands
and not just this one very specific deep dig thing into mv.

This command line shell feature dates back to ksh.

Bob



reply via email to

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