T
Thomas Gagne
When file names have more than eight characters, directory wildcards
seems to stop working.
I created two files shown in the directory listing below. In my C#
program I was hoping to distinguish one from from another using
DirectoryInfo.GetFiles("abc??????????????") to only return the first
file. As it turns out, when file names are longer than eight characters
the wildcards stop working.
In the script below, I do a DIR, a DIR abc???? and a DIR abc?????. Note
how both filenames show-up in the last query even though both of them
have more than five characters following "abc".
I can't be the first one to notice this. Is there another DirectoryInfo
class substitute I should be using?
C:\Users\Thomas\testdir>dir
Volume in drive C is WINDOWS
Volume Serial Number is 4CD9-E01A
Directory of C:\Users\Thomas\testdir
05/19/2009 12:24 PM <DIR> .
05/19/2009 12:24 PM <DIR> ..
05/19/2009 12:22 PM 15 abc20090519123456
05/19/2009 12:23 PM 27 abcde20090519123456
2 File(s) 42 bytes
2 Dir(s) 46,888,103,936 bytes free
C:\Users\Thomas\testdir>dir abc????
Volume in drive C is WINDOWS
Volume Serial Number is 4CD9-E01A
Directory of C:\Users\Thomas\testdir
File Not Found
C:\Users\Thomas\testdir>dir abc?????
Volume in drive C is WINDOWS
Volume Serial Number is 4CD9-E01A
Directory of C:\Users\Thomas\testdir
05/19/2009 12:22 PM 15 abc20090519123456
05/19/2009 12:23 PM 27 abcde20090519123456
2 File(s) 42 bytes
0 Dir(s) 46,888,103,936 bytes free
seems to stop working.
I created two files shown in the directory listing below. In my C#
program I was hoping to distinguish one from from another using
DirectoryInfo.GetFiles("abc??????????????") to only return the first
file. As it turns out, when file names are longer than eight characters
the wildcards stop working.
In the script below, I do a DIR, a DIR abc???? and a DIR abc?????. Note
how both filenames show-up in the last query even though both of them
have more than five characters following "abc".
I can't be the first one to notice this. Is there another DirectoryInfo
class substitute I should be using?
C:\Users\Thomas\testdir>dir
Volume in drive C is WINDOWS
Volume Serial Number is 4CD9-E01A
Directory of C:\Users\Thomas\testdir
05/19/2009 12:24 PM <DIR> .
05/19/2009 12:24 PM <DIR> ..
05/19/2009 12:22 PM 15 abc20090519123456
05/19/2009 12:23 PM 27 abcde20090519123456
2 File(s) 42 bytes
2 Dir(s) 46,888,103,936 bytes free
C:\Users\Thomas\testdir>dir abc????
Volume in drive C is WINDOWS
Volume Serial Number is 4CD9-E01A
Directory of C:\Users\Thomas\testdir
File Not Found
C:\Users\Thomas\testdir>dir abc?????
Volume in drive C is WINDOWS
Volume Serial Number is 4CD9-E01A
Directory of C:\Users\Thomas\testdir
05/19/2009 12:22 PM 15 abc20090519123456
05/19/2009 12:23 PM 27 abcde20090519123456
2 File(s) 42 bytes
0 Dir(s) 46,888,103,936 bytes free