[MLUG] copying many trees together

Mike Miller mbmiller at taxa.epi.umn.edu
Tue Sep 4 23:16:17 CDT 2007


Suppose I have a bunch of directory trees like these and there may be 
files in any all of the directories:

A-- foo
     `-- bar


B-- foo
     `-- bar
         `-- billy
             `-- willy


C-- foo
     `-- bar
         `-- billy
             `-- sue


D-- foo
     `-- bar
         `-- sally
             `-- joe


E-- foo
     `-- baz
         `-- fun
             `-- stuff


F-- foo
     `-- baz
         `-- unfun
             `-- stuff

I want to put all of those directories, with the files into a single tree 
like so:

X-- foo
     |-- bar
     |   |-- billy
     |   |   |-- sue
     |   |   `-- willy
     |   `-- sally
     |       `-- joe
     `-- baz
         |-- fun
         |   `-- stuff
         `-- unfun
             `-- stuff

This could be done in succession with files from A copied first, then B, 
then C, etc., and it would be fine to overwrite files because files with 
the same name in the same position in the tree are always identical.

What's the best way to do this?  Is there anything made for this?  Does 
rsync do this kind of thing?  I wish cp could do it but I don't see an 
option for it.

Mike



More information about the members mailing list