Weird behavior with *1

Viewed 46

I wonder about a special behavior of the expression *1 under Windows. I have threesub-folders: "s1", "s2" and "a b". When I type:

dir *1

it will list "s1" as well as "a b". In fact it will list all folders that have a space in the file name.

dir *2

works as expected.

Anyone any clue?

1 Answers

Alex K. is correct.

The name a b has a space and thus it's treated like a "long" file name. The system will generate an alternative "short" file name for the benefit of older applications that don't cope with "long" file names. The short name will be an 8.3 name that likely ends in ~1. dir (and most other programs that do wildcard searches on Windows) will look at both the "long" file name and the "short" one when determining if there is a match.

Related