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.
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:
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