When using the asterisk wildcard character in a searchPattern (for example, "*.txt"), the matching behavior varies depending on the length of the specified file extension. A searchPattern with a file extension of exactly three characters returns files with an extension of three or more characters, where the first three characters match the file extension specified in the searchPattern. A searchPattern with a file extension of one, two, or more than three characters returns only files with extensions of exactly that length that match the file extension specified in the searchPattern. When using the question mark wildcard character, this method returns only files that match the specified file extension. For example, given two files in a directory, "file1.txt" and "file1.txtother", a search pattern of "file?.txt" returns only the first file, while a search pattern of "file*.txt" returns both files.http://msdn.microsoft.com/en-us/library/ms143327.aspx
The following list shows the behavior of different lengths for the searchPattern parameter:
- "*.abc" returns files having an extension of .abc, .abcd, .abcde, .abcdef, and so on.
- "*.abcd" returns only files having an extension of .abcd.
- "*.abcde" returns only files having an extension of .abcde.
- "*.abcdef" returns only files having an extension of .abcdef.
Because this method checks against file names with both the 8.3 file name format and the long file name format, a search pattern similar to "*1*.txt" may return unexpected file names. For example, using a search pattern of "*1*.txt" will return "longfilename.txt" because the equivalent 8.3 file name format would be "longf~1.txt".
Computer, Technology, Databases, Google, Internet, Mobile, Linux, Microsoft, Open Source, Security, Social Media, Web Development, Business, Finance
Tuesday, August 05, 2008
.NET DirectoryInfo.GetFiles() Method Unexpected Behaviour On 3-Letter Extension
According to an article from the MSDN, DirectoryInfo.GetFiles() method will give unexpected behaviour on 3-letter extensions. I quote Microsoft as below:
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Google url shortener service, goo.gl , is now much improved with newly included features like easier copy and paste, and ability to delete e...
-
I would like to apologize that sigining of my guestbook is not possible at the moment due to an unexpected bug. There is already 74 entries ...
-
Get accurate and real-time bus arrival information for public bus operators in Singapore, including SBS Transit, SMRT Buses, Go-Ahead Singap...
-
Why I choose to remain single Sun, Apr 05, 2009 - The Straits Times My parents have a loving relationship, but I knew I could not live my li...
-
As of today, Google will start using a new shortened url - g.co , to promote Google websites. g.co works differently as compared to a long-t...
No comments:
Post a Comment
Do provide your constructive comment. I appreciate that.