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亿。 但是,我一人可能就很有可能是世界最傻的了。我真是个不折不扣的大木头。真是受不了自己。
-
On 25 Mar 2008, I received a malicious email claiming to be from Singnet . That email attempts to trick someone into replying with their Sin...
-
For anyone living in or visiting Singapore, mastering the public transport system is a rite of passage. While the MRT is efficient, the exte...
-
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...
-
*********** Try to sleep now, close your eyes Soon the birds would stop singing Twinkling stars, are shining bright They'll be watch...
No comments:
Post a Comment
Do provide your constructive comment. I appreciate that.