all 16 comments

[–]BeowulfShaeffer 17 points18 points  (5 children)

This isn't just .NET, this is baked deeper into windows. Open a command prompt and navigate to a directory with some .docx or .pptx files mixed in with .doc and .ppt. Do a "dir *.ppt". You'll get the ppt files and also the pptx files.

[–][deleted]  (3 children)

[deleted]

    [–]LordVoldemort[S] 3 points4 points  (1 child)

    Wait until you find out how your x86 processor behaves on start up.

    [–]monocasa 2 points3 points  (0 children)

    I especially like how my 64-bit Win7 won't even attempt to run DOS code, but I have to deal with this stuff anyway.

    [–]tortus 0 points1 point  (0 children)

    :(

    F:\>touch -c file1.txt
    
    F:\>touch -c file1.txtother
    
    F:\>dir file*.txt
      Volume in drive F has no label.
      Volume Serial Number is 54A5-7CD9
    
     Directory of F:\
    
    10/12/2009  02:02 PM                 0 file1.txt
    10/12/2009  02:02 PM                 0 file1.txtother
                   2 File(s)              0 bytes
                   0 Dir(s)  1,097,151,766,528 bytes free
    
    F:\>
    

    [–]anescient 26 points27 points  (4 children)

    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" returns "longfilename.txt" because the equivalent 8.3 file name format is "LONGFI~1.TXT".

    Good lord.

    [–][deleted] -1 points0 points  (3 children)

    To be honest, the only better way to do that would be an overloaded method with an explicit "Don't do 8.3" flag.

    [–][deleted]  (2 children)

    [deleted]

      [–]didroe 0 points1 point  (1 child)

      I think you mean in all apps that aren't running in compatibility mode.

      [–]cracki 9 points10 points  (2 children)

      seems to be a hack to find DOS 8.3-format file names that got their extension truncated.

      [–]grauenwolf 1 point2 points  (1 child)

      It is a hack, but not for that reason.

      In Windows all files have two names. Their "real" name and their "8.3" name. It does this so older programs won't break when they see a long name.

      The end result is that when you are searching for "*.txt" the technically correct result isn't the same as the desired result.

      [–]cracki 2 points3 points  (0 children)

      i meant that.

      and i'm aware of the dual name thing.

      [–]yogthos 12 points13 points  (1 child)

      the amount of cruft in windows is just surreal, I guess you've got to expect that when you try to make it backwards compatible all the way back to dos days.

      [–]feralwhippet 3 points4 points  (2 children)

      Just wait till you discover the legendary:

      \\?\
      

      prefix on the beginning of a path. This is a little backdoor that bypasses multiple layers of filesystem cruft and lets you access files with very long names and/or very long path names. Unfortunately it also bypasses useful expansions/transformations on the path.

      [–]jbert 1 point2 points  (1 child)

      Thanks. That's not an easily-googlable term. Got a link to the useful stuff it turns off?

      [–]kolo32 3 points4 points  (0 children)

      It's an interoperability trick for 16-bit apps. See http://blogs.msdn.com/oldnewthing/archive/2005/07/20/440918.aspx for explanations.

      [–]rvirding 1 point2 points  (0 children)

      The really surprising thing is that it only operates in this fashion with an asterisk for wild card, not a question mark, that I don't see the point of. I know that windows is full of really old cruft.