Is there a better way to do this? (I want to find files that match any of some extensions and don't match any of several other strings, or are not in some directories.):

 import std.file;

...

 string  exts  =  "*.{txt,utf8,utf-8,TXT,UTF8,UTF-8}";
 string[]  exclude  =  ["/template/",  "biblio.txt",  "categories.txt",
        "subjects.txt",  "/toCDROM/"]

 int  limit  =  1
 //  Iterate  a  directory  in  depth
 foreach  (string  name;  dirEntries(sDir,  exts,  SpanMode.depth))
 {  bool  excl  =  false;
    foreach  (string  part;  exclude)
    {  if  (part  in  name)
       {  excl  =  true;
          break;
       }
    }
    if  (excl)  break;
etc.

Reply via email to