You are not logged in.
I have some complex CMD scripts in which *.* in DIR, FOR and others are intended to match long names. I believe they are failing due to increased qty of files now causing unwanted matches with short names e.g.
P:\Dance>DIR 00248* /x
Volume in drive P is MUSIC4
Volume Serial Number is 0000-005B
Directory of P:\Dance
2016-10-05 20:25 11,256,755 002480~1.WMA 00724349996922-1-1.wma
1 File(s) 11,256,755 bytes
0 Dir(s) 801,932,124,160 bytes free
P:\Dance>
How best to workaround this? I won't consider disabling short names and risking breakage to other apps.
OS in Win 7 and FS in NTFS.
Offline
Short filename issues are described on this page: https://ss64.com/nt/syntax-filenames.html
The behaviour of matching both the long and short filename is not something you can turn off, other then by disabling/removing short filenames altogether.
If you don't want to do that, I think the best option is to just exclude any filename which contains a ~ character, by piping the list of filenames to FIND /v "~"
That is of course assuming none of the long filenames contain the ~ character.
FWIW, we have had long filenames for 23 years now, the number of applications which can't handle them is vanishingly small.
The main reason for keeping short filenames around is that you might want the shorter 8.3 identifier for a file when the 260 char file limit has been exceeded.
Offline
If you don't want to do that, I think the best option is to just exclude any filename which contains a ~ character, by piping the list of filenames to FIND /v "~". That is of course assuming none of the long filenames contain the ~ character.
Thanks. Let's note the fact that a assumption is in general impossible to verify.
FWIW, we have had long filenames for 23 years now, the number of applications which can't handle them is vanishingly small.
Agreed, but my concern with old apps is those that are sensitive to short names regardless.
The main reason for keeping short filenames around is that you might want the shorter 8.3 identifier for a file when the 260 char file limit has been exceeded.
Coo. I didn't know that. How could one exceed the 260 char file path limit?
Offline
Correction: that this assumption is in general impossible to verify.
Offline
Coo. I didn't know that. How could one exceed the 260 char file path limit?
By dragging and dropping folders around.
By mapping a drive:
e.g. you have a folder on a server called E:\workgroups\
thats mapped for the users as X:
A legal filename on the client X:\something\.... 158 chars
then becomes on the server E:\workgroups\something\...168 chars (and then your server backup software fails to read it.)
There are probably other ways too.
Saying that, the the "\\?\" prefix is generally an easier/better method of reading very long filenames than using the old 8.3 filename.
Offline
Useful to know. Thanks.
Offline