1

I am running 2003 server (latest service pack). When i type this on the command line:

dir 2010*

or

 dir 2010*.* 

i receive this as the result:

    02/01/2011  02:34 PM             2,460 2011-02-01-14-34-23-807.mdn  
    02/02/2011  08:59 AM             3,757 2011-02-02-08-59-32-604.req  
    02/01/2011  09:16 AM               235 2011-02-01-09-16-35-104.dat  
    02/02/2011  05:06 PM               460 2011-02-02-17-06-05-166.log  
    02/01/2011  03:31 PM            66,570 2011-02-01-15-31-27-838.dat  
    02/01/2011  03:16 PM               145 2011-02-01-15-16-51-135.log  
    02/01/2011  08:52 PM         1,608,916 2011-02-01-20-52-57-416.req
                   7 File(s)      1,682,543 bytes  
                   0 Dir(s)  42,891,452,416 bytes free  

can anyone tell me why? i was expecting to see a list of only files that begin with "2010". there are no such files in the directory, so i wasn't expecting to see anything. i must either misunderstand how DIR handles wildcards or i'm doing something stupid.

1
  • If you have some Linux/Unix knowledge, you could install cygwin - isolated application - that offers a true Linux terminal, with all the convenient commands, and bash.
    – Déjà vu
    Feb 3, 2011 at 16:40

2 Answers 2

3

This answer on Super User from user grawity reveals that the answer lies in the way Windows creates 8.3 filenames and that the DIR command looks at both filenames.

You can see what's happening by using DIR /X to show the short filenames.

From that answer:

When using the NTFS filesystem, 8.3 name creation can be disabled system-wide using:

    fsutil behavior set disable8dot3

However, this won't affect existing names.

2
  • Just out of curiosity: the short names of 2011-... start with 2010 ? (the commands being DIR 2010*.*)
    – Déjà vu
    Feb 3, 2011 at 16:41
  • 1
    @ring0: They can based on the rule quoted in the answer I linked to. "if at least 4 files or folders already exist with the same initial 6 characters in their short names, the stripped LFN is instead truncated to the first 2 letters of the basename (or 1 if the basename has only 1 letter), followed by 4 hexadecimal digits derived from an undocumented hash of the filename, followed" Feb 3, 2011 at 17:06
0

dir /OD will sort my date so from there in powershell equivalent would be Get-ChildItem | Sort-Object Date and if you include something Where-Object {!$_.Mode -match "h"} it should do the trick

1
  • that's nice (and i am aware of the various DIR options), but i'm not really asking how to get the results. I'm asking why a DIR 2010* is returning results that i would think i'd only see if doing DIR 2011*. sorry if my question wasn't clear. i edited the question's formatting to improve it. Feb 3, 2011 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .