merging file sub-trees

Bill Mullen moon at lunarhub.com
Mon Jun 2 15:38:30 EDT 2003


On Mon, 2 Jun 2003, Lee D. Rothstein wrote:

> At various different times 'mv' alone; or 'cp' followed by an 'rm' would
> do this, but alas, no more.
> 
> In brief, I want the merge to move everything from 'a' into 'c',
> overwriting all like-named files, and merging everything else
> 
> Example:
> --------
> 
> Two original directories in the current directory: 'a', 'c'.
> 
> I would issue following command:
> 
>  $ merge a c
> 
> on the following subtrees:
> 
> --
> 
> a/
>  1.txt
>  a.txt
> a/b/
>  3.txt
>  tenex.c
> a/c
>  foo.txt
>  foobar.txt
> 
> --
> 
> c/
> c/a/
>  1.txt
>  os360.o
> c/a/b/ 
>  tenex.c
>  larrysucks2.bat
> c/b/
>  aardvark.texi
>  bleet.1
> c/b/a/
>  billsux.alot
> 
> --
> 
> to yield the following results:
> 
> --
> 
> c/
> c/a/
>  1.txt
>  a.txt
>  os360.o
> c/a/b/
>  3.txt
>  tenex.c
>  larrysucks2.bat
> c/b/
>  aardvark.texi
>  bleet.1
> c/b/a/
>  billsux.alot

But what happened to:

c/a/c/
 foo.txt
 foobar.txt

? :)

> How can I do this without writing the shell script from hell.

And "cp -a --reply=yes a c/ && rm -fR a" won't do this?

-- 
Bill Mullen   moon at lunarhub.com   MA, USA   RLU #270075   MDK 8.1 & 9.0
"Giving money and power to the government is like giving whiskey and
car keys to teenage boys."  - P.J. O'Rourke



More information about the gnhlug-discuss mailing list