1.

Solve : Count Filenames Containing a User-Specified Extension?

Answer»

That's the reason - the shortname generation doesn't follow the rules on XP and earlier (and apparantly Win 7 and 8 32 bit).

I don't have a 64 bit box to test on...I'm surprised; I'd have thought it was a filesystem thing, rather than an OS bitness issue, but your 32 bit W7 & W8 results suggest not.

On W7 64 I tried creating the files on a FAT formatted SD card that happened to be in my card reader; same behaviour (*.txt finds only fileN.txt)
I posted a request in alt.msdos.batch.nt with this batch file, to gauge if it is universal. I'll post results later.


Code: [Select]@echo off
>file1.txt echo abc
>file2.txt echo abc
>file3.txtx echo abc
>file4.txtx echo abc

dir /x *.txt*

for %%a in (*.txt) do echo %%a

pause
This is my Win 8 32 bit machine - same as earlier.


Directory of d:\ABC

20/12/2012 08:08 AM 5 file1.txt
20/12/2012 08:08 AM 5 file2.txt
20/12/2012 08:08 AM 5 FILE3~1.TXT file3.txtx
20/12/2012 08:08 AM 5 FILE4~1.TXT file4.txtx

file1.txt
file2.txt
file3.txtx
file4.txtx
Press any key to continue . . .
foxidrive, do you sleep during the day?
Quote from: Salmon Trout on December 19, 2012, 03:33:49 PM

foxidrive, do you sleep during the day?
Drat! My Vampire secret is out!
(I have insomnia and sleep when I can.)

Two replies are in so far - XP 64 bit and Win7 Pro 64 bit - and both show 'standard' 32 bit behaviour.

On my Windows 7 x64 as well as Windows 8 x64 systems, Ultimate and Professional respectively (doubt that matters but it might), *.txt matches a .txtx file, and dir /x SHOWS the short FILENAME as having a .txt extension.
So my x64 system is the odd one?
Another Win7HP 64 bit machine also shows the 'usual' behaviour.

It would seem just that the behaviour can't be predicted for short filename generation.Dunno if this sheds any light...

D:\test-delete>for /l %A in (1,1,3) do @echo hello world > file%A.lex

D:\test-delete>for /l %A in (1,1,3) do @echo hello world > file%A.lexi

D:\test-delete>for /l %A in (1,1,3) do @echo hello world > file%A.lexicon

D:\test-delete>dir
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 <DIR> .
20/12/2012 18:12 <DIR> ..
20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 file1.lexi
20/12/2012 18:12 14 file1.lexicon
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 file2.lexi
20/12/2012 18:12 14 file2.lexicon
20/12/2012 18:12 14 file3.lex
20/12/2012 18:12 14 file3.lexi
20/12/2012 18:12 14 file3.lexicon
19/12/2012 20:01 43 test.bat
10 File(s) 169 bytes
2 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir /x
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 <DIR> .
20/12/2012 18:12 <DIR> ..
20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 FILE1~1.LE~ file1.lexi
20/12/2012 18:12 14 FILE1~2.LE~ file1.lexicon
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 FILE2~1.LE~ file2.lexi
20/12/2012 18:12 14 FILE2~2.LE~ file2.lexicon
20/12/2012 18:12 14 file3.lex
20/12/2012 18:12 14 FILE3~1.LE~ file3.lexi
20/12/2012 18:12 14 FILE3~2.LE~ file3.lexicon
19/12/2012 20:01 43 test.bat
10 File(s) 169 bytes
2 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir *.lex
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 file3.lex
3 File(s) 42 bytes
0 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir *.lexi
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 14 file1.lexi
20/12/2012 18:12 14 file2.lexi
20/12/2012 18:12 14 file3.lexi
3 File(s) 42 bytes
0 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir *.lex*
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 file1.lexi
20/12/2012 18:12 14 file1.lexicon
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 file2.lexi
20/12/2012 18:12 14 file2.lexicon
20/12/2012 18:12 14 file3.lex
20/12/2012 18:12 14 file3.lexi
20/12/2012 18:12 14 file3.lexicon
9 File(s) 126 bytes
0 Dir(s) 275,366,141,952 bytes free

D:\test-delete>The short name generation is different - but short names can even be random hex numbers in some cases, so it's not an issue.

Quote from: foxidrive on December 20, 2012, 02:23:34 PM
short names can even be random hex numbers

I noticed that when I WENT to 1000 of each extension.


Discussion

No Comment Found