Title: NTFS: Copy files with similar long/short file name - Who can explain this phenomenon?
Tags: copy;filenames;ntfs;cp;short-filenames
Question: 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&gt;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&gt;cp "06-05-29, Testfile.ppt" ../
C:\test&gt;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:\&gt;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


Here is another answer: 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

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:12/18/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<copy><filenames><ntfs><cp><short-filenames>', 'Title': 'NTFS: Copy files with similar long/short file name - Who can explain this phenomenon?', 'ViewCount': 142, 'id': 34357352, 'user_AboutMe': None, 'user_AccountId': 5576808.0, 'user_DisplayName': 'Tommy Nogger', 'user_Reputation': 1.0, 'user_Views': 1.0, 'user_id': 4419971.0}}