Re: Deleting a Directory

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Wed, 24 Aug 2005 15:45:32 +0200 (MEST)


Hi Dylan,

Thanks for this remark.
Effectively two steps were required to delete a directory.

    f->Delete("newdir;*");
will now remove the directory on disk AND memory. Fix now in CVS.

Rene Brun

On Tue, 23 Aug
2005, Dylan Maxwell wrote:

> Dear Roottalk,
>
> I want to completely remove a TDirectory from a TFile.
> For example try the following script (also attached).
>
> {
> TFile *f = new TFile("test.root", "RECREATE");
>
> TDirectory *d = f->mkdir("newdir");
>
> cout << endl << endl << "The file now contains a directory on file and in memoroy..." << endl;
> f->ls();
>
> f->Delete("newdir;*"); //delete directory
>
> cout << endl << endl << "The file now contains a directory in memory..." << endl;
> f->ls();
>
> f->Delete("newdir");
>
> cout << endl << endl << "The file still contains a director in memeory..." << endl;
> f->ls();
>
> delete d;
>
> cout << endl << endl << "The directory has been completely removed." << endl;
> f->ls();
> }
>
> Is this the expected behaviour when deleting a TDirectory from a TFile?
> I would think that TDirectory::Delete() should be able to completely remove a subdirectory?
> Maybe I've missed something?
>
> I'm running ROOT v4.04 on Scientific Linux 4.1.
>
> Thanks,
> Dylan
>
Received on Wed Aug 24 2005 - 15:45:40 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET