Re: moving a TDirectory from one TFile to another

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Nov 26 1998 - 10:18:39 MET


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:40 MET