How to make a real physical directory on the disk?

I am presently making some macros for doing some check plots, and I have an increasing amount of files that I would like to sort in directories.

Given a basename:

TString basename = “mydata”;

I open the file

basename+".root"

I make my check histos, and I would then like to save the ps-files in “./”+basename"/". I cannot however figure out how to actually create this directory. I have tried constructs like

TUnixSystem* a = new TUnixSystem() ;
a->MakeDirectory(“testdir”);

but then it complains that only one instance of TUnixSystem is allowed. However TUnixSystem does not have a getInstance method… I am running out of ideas. Does anyone know how to do this?

If variables could be passed to the command line it would also help. Something like:

TString basename = “mydata”
.! mkdir -p $basename

Any thoughts?

Hi,
you should #include “TSystem.h”, and use gSystem->MakeDirectory(“a_dir”).
Axel.

You can simply use:

gSystem->mkdir("testdir",kTRUE); // same a mkdir -p testdir

[quote]If variables could be passed to the command line it would also help. Something like:
TString basename = “mydata”
.! mkdir -p $basename
[/quote]
Can be done via

[quote]Does anyone know how to do this? [/quote]I suggest to your re-read the User’s Guide and take another look to the tutorials (in $ROOTSYS/tutorials).
Cheers,
Philippe.