Renaming TDirectory frustration

Hi,

I am trying to rename a TDirectory in an existing ROOT file. I have tried all of the obvious things (and then some): I can Get the directory into memory and rename it. However, Write() always returns “0” and nothing gets written to disk. Am I missing something here?

TFile f(“test.root”,“update”);
TDirectory T = (TDirectory)f.Get(“olddir”);
T->Write(“newdir”)

Write returns 0
f->ls("-m") shows my renamed directory
f->ls("-d") shows the old directory name

Thanks,
Tim

There is no direct function to rename a directory.
Create a new directory newdir
cd to newdir
call olddir.ReadAll()
call newdir.Write()

Rene

Wow. So if I have a big directory (50 MB) and all I want to do is give the directory a new name, that costs me all that space? That’s insane.

I guess I’ll do it anyway. I have no choice!

Thanks,
Tim

If reading all objects from a directory takes too much space,
copy objects one by one in a loop.

Rene