I try to find an explanation for the following result of a copy process under Windows/NTFS.
In the source directory, there are 2 files:
C:\test>dir /x
[..]
12/18/2015 12:21 PM 4,638,208 06-05-~3.PPT 06-05-29, Testfile.ppt
12/18/2015 12:21 PM 1,683,456 06-05-~1.PPT
[..]
As you can see, there is one file with a short AND a long filename and another file without a short filename but a short filename as a long filename. Now, I copy these two files into a different directory:
C:\test>cp "06-05-29, Testfile.ppt" ../
C:\test>cp "06-05-~1.PPT" ../
After copying the second file, suprisingly, the first file disappears and the second file takes the filename of the first file over:
C:\>dir /x
[..]
12/18/2015 12:31 PM 1,683,456 06-05-~1.PPT 06-05-29, Testfile.ppt
[..]
How is that possible? I could imagine that NTFS is using the short filename internally for copying, however, even the short file name is not the same for both files; also, how can it take over the filename?
Any assumptions/suggestions/answers to that phenomenon appreciated.
Thanks Tommy
It is 100% likely that your cp program knows nothing about short names and did nothing to preserve the short name when copying. In this case, your first cp command (where you specified a long name) did precisely what you asked it to, copying a file with a long name and generating a unique shortname in that directory.
Your second cp command copied a file name with precisely the same short name which caused the original file to be overwritten.
See https://en.wikipedia.org/wiki/8.3_filename