Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Count Filenames Containing a User-Specified Extension  (Read 9409 times)

0 Members and 1 Guest are viewing this topic.

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Count Filenames Containing a User-Specified Extension
« Reply #15 on: December 19, 2012, 01:23:29 PM »
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...

Salmon Trout

  • Guest
Re: Count Filenames Containing a User-Specified Extension
« Reply #16 on: December 19, 2012, 01:44:14 PM »
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.


Salmon Trout

  • Guest
Re: Count Filenames Containing a User-Specified Extension
« Reply #17 on: December 19, 2012, 01:55:27 PM »
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)

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Count Filenames Containing a User-Specified Extension
« Reply #18 on: December 19, 2012, 02:11:46 PM »
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 . . .

Salmon Trout

  • Guest
Re: Count Filenames Containing a User-Specified Extension
« Reply #19 on: December 19, 2012, 03:33:49 PM »
foxidrive, do you sleep during the day?

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Count Filenames Containing a User-Specified Extension
« Reply #20 on: December 19, 2012, 03:52:52 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.


BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: Count Filenames Containing a User-Specified Extension
« Reply #21 on: December 19, 2012, 05:54:28 PM »
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.
I was trying to dereference Null Pointers before it was cool.

Salmon Trout

  • Guest
Re: Count Filenames Containing a User-Specified Extension
« Reply #22 on: December 20, 2012, 02:46:39 AM »
So my x64 system is the odd one?

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Count Filenames Containing a User-Specified Extension
« Reply #23 on: December 20, 2012, 05:11:21 AM »
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.

Salmon Trout

  • Guest
Re: Count Filenames Containing a User-Specified Extension
« Reply #24 on: December 20, 2012, 11:02:30 AM »
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>

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Count Filenames Containing a User-Specified Extension
« Reply #25 on: December 20, 2012, 02:23:34 PM »
The short name generation is different - but short names can even be random hex numbers in some cases, so it's not an issue.


Salmon Trout

  • Guest
Re: Count Filenames Containing a User-Specified Extension
« Reply #26 on: December 20, 2012, 02:42:00 PM »
short names can even be random hex numbers

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