I wrote a piece of code that used System.IO.Directory.GetFiles(string, string) and executed the code in Windows XP. I was totally dump founded when I discovered this function returning more than what was expecting. The same things happened in Vista & Windows 7.
I was trying to get a list of files '*.tab' from a nominated directory but the result contained files meeting '*.tab*'. I was shocked. So I went to my favourite tool, the command prompt, and did a dir *.tab in the same directory and got the same result. Powershell does not produce this unexpected result.
Knowing System.IO.Directory.GetFiles() most likely P/Invoke down to Win32 API, I search through and confirmed the FindFirstFile() is responsible for this unexpected behaviour.
The explanation of this 'oddity' is given by Raymond Chen and you can blame the 8.3 file names for this problem.
So if you use System.IO.Directory.GetFiles(string, string), make sure you filter your results properly to avoid any unexpected results.
There is no way in CMD to list out a list of files with that kind of requirements.
A site devoted to discussing techniques that promote quality and ethical practices in software development.
- ► 2013 (13)
- ► 2012 (23)
- ▼ August (4)
- ► 2010 (60)
- ► 2009 (60)
- ► 2008 (25)
- ► 2007 (80)