Go to the documentation of this file.00001 #include <fstream.h>
00002 #include "Riostream.h"
00003 using namespace std;
00004
00005
00006 void filedir_namiter(TFile *f, TString fulldir, const char* wildcard)
00007 {
00008 TString fullname;
00009 TString curname;
00010 TRegexp wild(wildcard,kTRUE);
00011 TKey *key;
00012 TString curdir;
00013 TIter next(gDirectory->GetListOfKeys());
00014 while((key=(TKey*)next()))
00015 {
00016 if(strcmp(key->GetClassName(),"TDirectory")==0)
00017 {
00018 curdir.Form(fulldir.Data());
00019 curdir.Append(key->GetName());
00020 curdir.Append("/");
00021 f->cd(curdir.Data());
00022 filedir_namiter(f,curdir,wildcard);
00023 }
00024 else
00025 {
00026 fullname.Form("%s%s",fulldir.Data(),key->GetName());
00027 curname.Form("%s",key->GetName());
00028 if(curname.Index(wild) != kNPOS)
00029 {
00030 std::cout.width(32);
00031 std::cout.fill('.');
00032 std::cout.setf(ios::left);
00033 std::cout << key->GetClassName() << " ";
00034 std::cout << fullname.Data() << std::endl;
00035 }
00036 }
00037 }
00038 return;
00039 }
00040
00041 void filedir(const char* file, const char* wildcard)
00042 {
00043 TString fulldir;
00044 TObject *namo;
00045 TFile *f;
00046 std::cout << "Directory of " << file << "(" << wildcard << ")" << std::endl;
00047 if(f = TFile::Open(file,"r"))
00048 {
00049 fulldir.Form("");
00050 filedir_namiter(f,fulldir,wildcard);
00051 f->Close();
00052 }
00053 else
00054 std::cout << file << " not found" << std::endl;
00055
00056 }