bluesxman wrote: ↑2022-Apr-12, 3:36 pmWithout any context of what you're trying to do, it's difficult to offer a solution.
I was trying to count each type of file in a given directory by using for loops to run through each extension, but the .jpeg files were being double-counted.
I already have a workaround, I was just wondering if there was a simple way to stop it from happening in case there's a future case where I want two similar extensions to be processed differently.
bluesxman wrote: ↑2022-Apr-12, 3:36 pmHowever,
FOR seems to be able to see through the fog (or rather it seems to be entirely oblivious to 8.3)
Yes, %%~xF will return the true extension, but then I have to include a bunch of IF statements to test for various types, which slows it down if processing a lot of files.
qwerty wrote: ↑2022-Apr-12, 5:07 pm
Another way to do this is with the where command. To search from your present directory:
Another option is forfiles:
I'm doing this on an old system under WinXP and I don't have either of those commands.
Apparently they're included in the "Windows 2000 Resource Kit", which I've never been able to find an official download page for, since Microsoft seems to have scrubbed all downloads for older versions of Windows from their web sites.
Simon Sheppard wrote: ↑2022-Apr-12, 5:12 pm
Confirmed, if you turn off 8.3 generation using:
Code: Select all
FSUTIL.exe behavior set disable8dot3 1
Then DIR *.jpe will not return the jpeg files.
Also 8.3 filename generation is turned off by default in all new (fresh install) Windows installations.
I am extremely leery of messing with the way Windows handles filenames.
Funny story: On my old Windows 98 system, one day Scandisk reported a long filename error, but didn't tell me what file it was. I didn't know how to find out, so every time Scandisk ran, it would stop with that same error. When I googled the problem, I found a recommendation to edit the Scandisk perferences and turn off "Validate long filenames".
HUGE MISTAKE!!! ***NEVER*** DO THIS ON A WINDOWS 98 SYSTEM!!!
The next time Scandisk ran, it was taking a very long time and after I stopped it and the system booted, I discovered that it had been in the process of going through my entire C: drive and renaming
EVERY file to its 8.3 name! Needless to say, this royally screwed up my system.
I also discovered that while a record of the long filenames still existed on the drive, there are absolutely no tools that will restore them in bulk. I found one program that would
show them to you and another that would recover
one file at a time with its long filename, but nothing else. I even contacted the company who made the latter tool and asked if the full, commercial version of the program would let me do it and was informed that no, that ability was not in the full version!
All of this makes me extremely hesitant to alter the way that Windows handles filenames on an existing system.