Update: the combination of both your suggestions worked: if (exists(BlankDirToDelete)) { try rmdir(`\\?\` ~ BlankDirToDelete); catch (FileException e) writeln(e.msg); } Thanks! Now I just have to find out why the block of the file extensions is failing.