Re: moving a TDirectory from one TFile to another
Rene Brun (Rene.Brun@cern.ch)
Thu, 26 Nov 1998 10:18:39 +0100
stefan kluth wrote:
>
> Hello,
>
> I am trying to move a TDirectory (and everything in it, including TTrees)
> from one TFile to another, but without success. I naivly used
> TDirectory::SetMother( ... ) to change the current file of this TDirectory
> to the new file (in "/" of the old file).
>
> I guess I also have to take care of other bookkeeping items, but I am sure
> what else is involved.
>
> Did anybody try something like this and could provide me with some example
> code?
>
> Or does anybody have more insight in the workings of TFile/TDirectory to
> give me a few hints on how to do this?
>
Hi Stefan,
TDirectory/TFile do not provide the functionality to copy/move
directories between files. This could be implemented using
the normal Unix semantics (say TDirectory::Mv and Cp).
Currently you must loop yourself on all keys of a directory,
import the object in memory and write it on the new directory.
Rene Brun