coreutils
[Top][All Lists]
Advanced

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

Re: Add --parents option to mv command in order to create parents direct


From: Pádraig Brady
Subject: Re: Add --parents option to mv command in order to create parents directories
Date: Wed, 08 May 2013 12:32:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 04/28/2013 05:55 PM, Rémy Lefevre wrote:
> Hello,
> 
> mkdir and cp commands have the --parents option to create parents directories 
> as needed. But this option is missing in mv. One has to create first the 
> directory structure using mkdir --parents and then mv the file. This option 
> is fine for simple moving command, but if one want to move files according to 
> a pattern in a big tree structure, it starts to be too complicate as the 
> directory name should be extracted for almost each moved file.
> 
> So another solution is to use the cp --parents command and then delete the 
> original files. But this solution is far from good for all the reasons that 
> differentiate a copy from a move.
> 
> So I propose to add a --parents option to mv command in order to create the 
> parents directories as needed. In the case of acceptance, I could write a 
> patch to add this feature.

Maybe, but I'm not sold on the need TBH.
At first glance it seems like it's uncommon enough
that using cp might suffice?  You could even do
this efficiently within a file system like:

{ cp -l --parents src dst || cp --parents src dst } && rm -r src

thanks,
Pádraig.



reply via email to

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