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
-
新加坡人口400万,亚洲人口4亿,全世界人口6亿。 但是,我一人可能就很有可能是世界最傻的了。我真是个不折不扣的大木头。真是受不了自己。
-
I was at Bugis Junction today and saw 蘇打綠 (Soda Green) performing. They look so much different especially the lead singer. I find their song...
-
Pledge to finish my 1st task after my 2 full days of rest by today. 03 March 2010 : CS4236 Project deadline It is basically a "waste-t...
-
Despite the implementation of a mandatory plastic bag charge in local supermarkets in July 2023, recent data reveals that consumers still pu...
-
I recently wrote a code snippet to fill arrays with a value. The below method is a generic method that will accept different data types. Hop...
No comments:
Post a Comment
Do provide your constructive comment. I appreciate that.