Re: Delete Files with root

From: Michael Kosta Mitrovski <Michael.Mitrovski_at_cern.ch>
Date: Thu, 23 Feb 2006 15:59:55 -0500


Hi Axel,

thanks for the answere I will try it.

Best regards,

Michael

Am 22.02.2006 um 14:37 schrieb Axel Naumann:

> Hi Michael,
> copy & paste the following onto a bash prompt:
>
> ---
> cat > deleteBroken.C << EOF
> void checkFile(const char* n) {
> TFile* f = new TFile(n);
> Bool_t remove=(!f || f->IsZombie());
> delete f;
> if (remove) printf("Almost called gSystem->Unlink(%s)\n",n);
> //if (remove) gSystem->Unlink(n);
> }
> void deleteBroken() {
> EOF
> ls *.root | sed 's,^\(.*\)$,checkFile(\"\1\");,' >> deleteBroken.C
> echo '}' >> deleteBroken.C
> root -l -b -q deleteBroken.C
> ---
>
> Instead of sed you can also use TSystem::OpenDirectory() /
> GetDirEntry() / FreeDirectory() to iterate over files from within
> ROOT.
>
> Axel.
>
> Michael Kosta Mitrovski wrote:
>> Dear rooters,
>> I produced Simulation files (20000) and some (5000) of them
>> crashed in the production (all of them are root-files). Is there a
>> way when I am analysing my files which are ok to delete the
>> otherones which crashed??? Thanks.
>> Best regards,
>> Michael
>
Received on Thu Feb 23 2006 - 21:59:35 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET