maphew

"dir *1" returns unexpected files

Check this out:

(XP) start > run "cmd" [enter]

echo dumdididum > a-file_1.txt
echo dumdididum > a-file_2.txt
echo dumdididum > a-file_3.txt
echo tweedledee > a-filetoo_1.txt
echo tweedledee > a-filetoo_2.txt
echo tweedledee > a-filetoo_3.txt
echo tweedledee > a-filetree_1.txt
echo tweedledee > a-filetree_2.txt
echo tweedledee > a-filetree_3.txt
echo justforfun > a-file-with-no-numbers.txt
dir /b *1.txt

a-file-with-no-numbers.txt
a-filetree_3.txt
a-filetree_2.txt
a-filetoo_1.txt
a-filetree_1.txt
a-file_1.txt

what's going on here?

(I'll post the answer in the comments later. But it took me and a friend and some generous netizens to get to the root of it.)

Comments {#commentz}#

  1. Prokhor wrote:

    So what's the deal with it?

    Posted 27 Nov 2007 at 2:04 pm

  2. matt wilkie wrote:

    Hi Prokhor,

    The deal is, dir matches by the the short 8 character name (the DOS name), while returning the long filename.

    Thanks for asking. I had to look a moment or so to remember! Unfortunately I can't locate my bookmark for the discussion which finally clued us into what was happening so I regretfully cannot credit the true discoverers.

    Posted 28 Nov 2007 at 1:13 pm


date: 2009-10-17
tags: [other]
category: Other