473,473 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

IO.Directory.GetFiles algorithm Bug?

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\\system3 2\\", "*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.
May 2 '06 #1
1 1871
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
"Hawk" <Ha**@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.com...
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\\system3 2\\", "*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.

May 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mullin Yu | last post by:
e.g. c:\test doc1.txt doc1.pdf doc2.txt doc2.pdf doc3.txt doc4.pdf doc5.txt doc5.pdf
3
by: S. Han | last post by:
I'm using Directory.GetFiles to enumerate files in a directory. The problem is if you have to enumerate all files + subdirectories recursively, it takes too much memory, and it fails. Is there...
2
by: John Smith | last post by:
Hello all: I am trying to search for more than one extension in a directory at the same time with the following code: string files = Directory.GetFiles(sDir, "*.doc*.dot"); However, this...
4
by: Elmo Watson | last post by:
Is there a way, with the System.IO class, to do a recursive list of a directory structure? For instance, in DirectoryInfo, you have GetDirectories and GetFiles .... In Directory, you have...
2
by: OpticTygre | last post by:
I have a directory of 27 files. The files end in either 1.txt, 2.txt, 3.txt, or 4.txt. If I say: For Each filename As String In...
3
by: Michael | last post by:
Hi, I have been using Directory.GetFiles("g://"); in my c# application. But now my boss want's me to do Directory.GetFiles(IP address); I have been unable to figure out how to get this to work....
3
by: cjb | last post by:
Is there a way to get Directory.GetFiles to return multi-language file names? I haven't found any overloads that allow any such parameter. The way I am using it now is: foreach (string d in...
3
by: Michael Jackson | last post by:
In my .NET 2.0 VS 2005 VB application, I'm using Directory.GetFiles(path) to get all the files in the directory. However, I'm getting an error regarding "Illegal character in Path", even though I...
0
by: tshad | last post by:
I am trying to do multiple Directory.GetFiles and append the results to one array that I will process. I tried this: string strFiles; strFiles = Directory.GetFiles(SemaSettings.InputFilePath,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.