Ignore a especific file

How can i ignore a specific file? let’s say i have 1test.xml , 2test.xml, 3test.xml, 4test.xml and i don’t want to the directory to read 1test.xml, i didn’t found a function in ofDirectory only one that exclude
the extension dir.allowExt(“png”); i also search a c++ code but didn’t found much about it.

Hi, you just need to iterate through the directory and conditionaly do something with the files. like this:

ofDirectory dir;
dir.listDir("/your/directory/path");
for(int i = 0; i < dir.size(); i++){
if(dir.getName(i) != "fileToExclude.xml"){
// do something.
}

}

Hi Roy,
Yeah, i’m actually iterating trough the files is like a backend of xml files, the app read’s the directory and create a row for each xml and display some info that contain the xml file. But i need to ignore other xml files that dosn’t belong there but i can’t delete the file is there is a way to hide it or skipped?

Thanks.

Hi, just skip it on the iteration, based on the name.