IO.Directory.GetFiles algorithm Bug?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was writing my own wildcard compare algorithm and making a custom GetFiles
routine when I came across what I think is a bug in .net's own GetFiles.

My routine was coming up with different results than GetFiles so naturally I
thought it was my routine that was bugged but when I investigated it the
results from my algorithm where exactly what I would expect.

call: System.IO.Directory.GetFiles("d:\\windows\\system32\\", "*ae?*.*",
SearchOption.AllDirectories);

a sample of the results:
d:\windows\system32\dllcache\kbdgae.dll

Correct me if I am wrong but is '?' not mean 1 and only 1 of any character?

should it not skip the above file because there is no character between the
"ae" and the '.'?

I bring this up because I use GetFiles often and want to make sure I
understand what it is doing.
 
This method actually calls the API method FindFirstFile underneath the
covers, this behavior is handled there so it is consistant with other
windows apps.

From what I hear the API under the covers still uses 8.3 resolution and gets
confused with some more complex search strings (i.e. combining ? and *)

Easy work around, bring back the files and do a regexp on your own.

Cheers,

Greg
 
Back
Top