Removing TDirectory from existing file (to reduce size)

From: Seth Zenz <>
Date: Wed, 6 Sep 2006 13:21:52 -0700


I have an existing root file, which contains a number of TDirectories, which in turn have subdirectories and eventually various histograms. I need to make the file smaller in size, and as it happens some of the directories are unneeded; I would therefore like to remove them from the file.

I was able to use the TFile->Delete("directoryname;1") command to remove one of the directories. The problem is that, although the directory no longer shown in the file when I do ->ls(), the file is the same size on disk as before.

Is there a way to shrink the file now that it contains less data? Or, alternatively, is there a way to copy only the TDirectories I require (with all contents) and write them into a new file?

I'm using root 5.10.00e (the default version for ATLAS software release 12.0.2).

Seth Zenz Received on Wed Sep 06 2006 - 22:21:59 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET