Mkdir problem, directory already exists

Hi, I would very much like to do this:

Tfile * file = new TFile("afile","UPDATE") file->mkdir("a/b/c") file->mkdir("a/b/d")

but the second mkdir gives an error, that the directory “a” exists already. Can I do this in a way that does not involve cd() into “a” and then “b”?

Thanks a lot,


Hi Elias,

I updated the repository (revision 46719) to suppress the error message in this case. Before this revision, the only way to suppress the message is to use ‘cd’.



I have the same problem as elelias, however I don’t know how to use the cd workaround. What are the steps to create first a/b/c and then a/b/d without receiving an erro? Unfortunately I can not update my root, thus the cd workaround seems to be the only possible solution for my problem. I tried

TFile * file = new TFile("afile","RECREATE")

but had no luck: the error [quote]Error in TFile::mkdir: An object with name a exists already[/quote] remains.

TFile * file = new TFile("afile","RECREATE") file->mkdir("a") file->cd("a") gDirectory->mkdir("b") gDirectory->cd("b") gDirectory->mkdir("d")

It would be very appreciated if this info is included in the documentation. It is just not trivial.
Thank you,