|
From: | Rémy Lefevre |
Subject: | Re: Add --parents option to mv command in order to create parents directories |
Date: | Wed, 8 May 2013 14:53:52 +0200 |
Maybe, but I'm not sold on the need TBH.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.
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.
[Prev in Thread] | Current Thread | [Next in Thread] |