I have a directory, contains files:
"bc[1]",
"bc[2]",
.
.
.
"abc[1]",
"abc[2]",
.
.
.
and some other files.
I would like to find files with name "bc", but not include "abc" files.. I have the following code, it listed all the "bc" and "abc" files.
f->cd("SomePath");
TIter next(gDirectory->GetListOfKeys());
TKey *key;
while ((key = (TKey*)next()) ){
if (key != nullptr){
string name = key->GetName();
if (name.find("bc")!= std::string::npos){
cout<<name<< endl;
}
}
}
Thanks in advance for your help!