Reputation: 191
I am copying a list of files using a prefix (i.e., ABCD*) to match files in a batch script. However, some files that appear to match are being left behind while other files that don't match are getting grabbed.
I ran a dir /X and found that the shortname for a handful of the files didn't match their longname:
4/17/2015 02:04 PM 554 ABCDEF~1.TXT abcdefghijklmnopqrs.txt
4/17/2015 02:08 PM 123 ABCDEF~2.TXT 1234567890.txt
4/17/2015 03:18 PM 233 987654~1.TXT abcdefg123456.txt
Any idea why something like this might happen and how to resolve it?
Upvotes: 2
Views: 482
Reputation: 20189
If your sample data is representative of your actual files, you could specify ABCDEFG*
to workaround this issue.
EDIT
Since the above suggestion is not an option, you could use FSUTIL
to remove all of the 8.3 names.
This command will analyze the files in the current directory (.
) and display the changes without actually making them.
fsutil 8dot3name strip /t .
Remove the /t
parameter to actually remove the 8.3 names.
You can also run:
fsutil 8dot3name strip
to see all of the options.
Upvotes: 2
Reputation: 70923
Short and long file names are not required to match. The default algoritm is documented here under "How NTFS Generates Short File Names". You can also find it in the wikipedia
You can change the short file name with
fsutil file setshortname longFileName shortFileName
Upvotes: 1