|
On FAT, the directory entry only holds the 8.3 name, which truncates the extension to 3 characters.
Retriving the full name can be quite costly (think fat via network)
So the options were:
- stick to 8.3 file names on FAT. Ask people funny questions when copying from NTFS to FAT
- DOS tools can not operate on your beautiful files
- slow down
dir *.xls by orders of magnitude -
dir *.xls works different on C: than on D: (if you limit the "weird" behavior to FAT) - A three-letter filter also includes N>3-letter elements
- A myriad of other solutions that in hindsight would have been much better anyway and are oh so trivial to implement on todays machines (remember, Windows 95)
(I could come up with a few...)
I'm not saying Microsoft made the best choice. But I am saying we'd have the same complaints for any other option chosen.
Note that other commands such as del "xyz" do not include them.
|
|
|
|
|
del *.xlsx
dir *.xls
Problem solved
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
|
I think its a limitation of the dir command only resolving 3 character extensions.
Pretty sure it does the same on htm v. html.
Government is not reason; it is not eloquent; it is force. Like fire, it is a dangerous servant and a fearful master. ~ George Washington
|
|
|
|
|
I suspect it's looking at both the long and short names, rather than ignoring short names for files with long names.
In pseudo-SQLese:
WHERE shortname LIKE '%.xls' OR longname LIKE '%.xls'
rather than something like
WHERE IFNULL(longname , shortname) LIKE '%.xls'
|
|
|
|
|
|
Dir /X at least shows you why
I have three files in this test directory:
test.htm
test2.html
test3.htmasdflkjasdgf
If you do a dir /X (show short names of files) it lists the short names and you can see that the extension only uses first 3.
C:\Users\ns\test>dir *.htm /X
Volume in drive C has no label.
Volume Serial Number is 509B-CBCC
Directory of C:\Users\ns\test
12/04/2014 11:31 AM 9 test.htm
12/04/2014 11:32 AM 11 TEST2~1.HTM test2.html
12/04/2014 11:32 AM 11 TEST3~1.HTM test3.htmasdflkjasdgf
3 File(s) 31 bytes
However, I think it is stupid and annoying also.
ls *.htm works perfectly.
|
|
|
|
|
|
it is a "feature" so you find all your Excel files
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
But I can say dir *.xls* to do that when, and only when, I want to.
|
|
|
|
|
How do you know what you want to see? Only Microsoft knows what you want. Duh.
|
|
|
|
|
When I want to see what Microsoft thinks I want to see I use Bing Videos.
|
|
|
|
|
|
That's odd. It doesn't do that for me on Win 8.1.
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\jeremy.falcon>cd C:\windows
C:\Windows>dir *.lo
Volume in drive C has no label.
Volume Serial Number is 0000-0000
Directory of C:\Windows
File Not Found
C:\Windows>dir *.log
Volume in drive C has no label.
Volume Serial Number is 0000-0000
Directory of C:\Windows
03/17/2014 09:02 PM 2,664 DtcInstall.log
11/18/2014 09:03 AM 613,588 PFRO.log
11/18/2014 09:31 AM 3,405 setupact.log
09/24/2014 08:29 AM 0 setuperr.log
09/29/2013 10:20 PM 5,446 vmgcoinstall.log
12/03/2014 08:24 PM 1,947,077 WindowsUpdate.log
6 File(s) 2,572,180 bytes
0 Dir(s) 386,710,196,224 bytes free
C:\Windows>
Jeremy Falcon
|
|
|
|
|
Create a file with an extension like logger , or login , or something and try it. (I don't have 8.x handy.)
|
|
|
|
|
Well that's messed up. Apparently 3 is the magic number for extensions to cause the screw up. Check this out...
c:\>dir *.*
Volume in drive C has no label.
Volume Serial Number is 0000-0000
Directory of c:\
11/25/2014 02:35 PM <DIR> Code
12/04/2014 11:09 AM 0 cp.logger
08/22/2013 09:22 AM <DIR> PerfLogs
11/18/2014 09:48 AM <DIR> Program Files
12/03/2014 09:44 AM <DIR> Program Files (x86)
03/18/2014 07:59 AM <DIR> Users
11/18/2014 09:59 AM <DIR> Windows
1 File(s) 0 bytes
6 Dir(s) 386,709,864,448 bytes free
c:\>dir *.lo
Volume in drive C has no label.
Volume Serial Number is 0000-0000
Directory of c:\
File Not Found
c:\>dir *.log
Volume in drive C has no label.
Volume Serial Number is 0000-0000
Directory of c:\
12/04/2014 11:09 AM 0 cp.logger
1 File(s) 0 bytes
0 Dir(s) 386,709,864,448 bytes free
c:\>ren cp.logger cp.lo
c:\>dir *.lo
Volume in drive C has no label.
Volume Serial Number is 0000-0000
Directory of c:\
12/04/2014 11:09 AM 0 cp.lo
1 File(s) 0 bytes
0 Dir(s) 386,709,839,872 bytes free
c:\>
Jeremy Falcon
|
|
|
|
|
'Xac'ly, pull up a stool.
|
|
|
|
|
It does the same with htm and html files. I suspect it's only dealing with three significant characters for the extension.
|
|
|
|
|
Sigh. All of this arises from the FindFirstFile() [^] Windows API function, which matches both long and short filenames, when the underlying file system supports both. This is the case for NTFS, although you can turn short filename generation off.
Software Zen: delete this;
|
|
|
|
|
Gary Wheeler wrote: you can turn short filename generation off
Sounds good. How?
modified 4-Dec-14 13:21pm.
|
|
|
|
|
|
|
This is one of the things we did at my previous job when we shipped (surveillance) DVRs. Windows Explorer becomes incredibly slow when you have millions of files on a drive.
I have never seen a problem related to this setting.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
On Win7 the default is 2, so I disabled and stripped short names on my work volume. I'll do the same at home.
|
|
|
|
|
Sounds like a backwards-compatibility issue:
But some quirks of the FCB matching algorithm persist into Win32 because they have become idiom.
For example, if your pattern ends in .* , the .* is ignored. Without this rule, the pattern *.* would match only files that contained a dot, which would break probably 90% of all the batch files on the planet, as well as everybody's muscle memory, since everybody running Windows NT 3.1 grew up in a world where *.* meant all files.
As another example, a pattern that ends in a dot doesn't actually match files which end in a dot; it matches files with no extension. And a question mark can match zero characters if it comes immediately before a dot.
There may be other weird Win32 pattern matching quirks, but those are the two that come to mind right away, and they both exist to maintain batch file compatibility with the old 8.3 file pattern matching algorithm.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|