Thanks Ali. Stupid of me, it is the dirEntries call that opens the directory and tries to read contents. I did this (below), but it still leaves the odd situation that Documents and Settings cannot be opened, and surely non-administrators have access to this folder.

try{
  auto dirs =  dirEntries(directory, SpanMode.shallow, false);

  foreach(DirEntry ent; dirs){
    if(ent.isDir) d ~= ent.name;
    if(ent.isFile){
      if(endsWith(ent.name, sufix)) f ~= ent.name;
    }
  }
}catch(FileException ex){
writeln("Error reading directory, probably no administrator privilege");
} finally{}

Reply via email to