It's pretty simple to replicate.

Create a folder with file "ABC123~1.txt"

Create a folder with file "ABC 123.txt"

Try to copy the file from the first folder to the second... windows asks if you want to overwrite?

I have tried other combinations of file names and can't seem to make it work e.g. ABCD will not work.

Why on earth does this happen?

I understand that the tilde is for short versions of paths but I don't see that "ABC123..." is short for "ABC 123"?

  • 2
    Windows removes the tilde from the file name when looking to see if an existing file with that name already exists. – Max Vernon Jun 24 '14 at 16:12

Because of the short file name feature of windows NT, the OS automatically strips tilde characters from the file name, leaving just a space.

What this means is that



ABC 123.txt

when windows writes the file to the destination.

When you then go and copy an actual file called 'ABC 123.txt' it complains because there's a file with that name already there.

In order for it to be recognized as a short file name, the tilde MUST be a sequential number of characters from the end of the name.

so if you have 2 file names, and a likely file name collision, your 2 files MUST be called




anything else that breaks the sequence, windows will interpret as a normal long file name and attempt to remove the tilde character.

It was for this reason, when long file names where first introduced in Windows 95, that so many pieces of software got broken, or corrupted files they where writing.

It was simply down to applications using what they got back from a directory call, tildes and all, and not respecting that there was a sequence there, which NTFS was keeping track of.

Update 25/6/14

It appears I didn't quite make the sequential aspect of things too clear, So i'll try and expand on it a little bit.

When windows names long files with short file names, there are 2 forces at play, first is that short file names are limited to 8 characters for the file name and 3 for the extension, secondly a lot of the characters allowed in long file names are not allowed in short.

Putting point 2 aside, and concentrating on point 1, this often means that with less than 10 similarly named files (It gets a bit more complicated with 10 or beyond) you typically only get 6 characters to name your file, and the remaining 2 are required for the sequential numbering.

Windows will start at ~1 and count up to ~9, typically concatenating that onto the first 6 legal characters of the file name, so if you saved 3 files, that resulted in 3 names you'd get:


The following long file names, would easily generate these, although so would others (But I'm trying to keep the example simple):

ABC 123456.txt
ABC  123.txt

Now, if you where then, too manually save a file called


Windows would NOT remove the tilde, why?

Simply because it recognizes that 4 comes after 3 and so it treats it like there are 4 shortened file names and puts it sequentially as expected.

If you then followed that with another file write to EG:

ABC 123888.txt

Windows will create a short file called:


Again because it respects the file sequence.

However, if you go back a step to where you created ~4 manually and instead created ~5, ~6 or anything out of sequence, windows should remove the tilde, because it now sees that the file your saving is not in sequence with the rest, and so it interperates that as NOT being a short form name, but rather a long form name, for which it then has to automatically generate a corresponding short file name.

Make sense?

There's a lot of complicated rules as to when windows (or more specifically NTFS) decides when and what to change, and frequently, just when you think you've got it, it goes and does something very unexpected.

Back in mid 90's it used to cause myself (and lot's of others like me) major headaches, esp accross networking systems such as netbios and novell netware, I'm glad it's all behind now and we can just use long names 99% of the time :-)

  • Ok, the information about windows stripping tilde characters helps. But I'm still not clear on why ABC123~1 where there is no space between C and 1 overwrites ABC 123 where there is a space. It also seems to work ONLY with certain length names. e.g. "Lem o.txt" is not replaced by "Lemo~1.txt" but "Lem on.txt" is replaced by "Lemon~1.txt" and "Lem ons.txt" by "Lemons~1.txt". Also note that "Lem~ons.txt" does not replace "Lem ons.txt" as you suggested in your answer. – Dave Williams Jun 25 '14 at 8:05
  • Your heading in the right direction though Dave, it's the sentimentality that matters, let me see if I can explain it better in the answer. – shawty Jun 25 '14 at 9:36
  • I admire your long and descriptive explanation. I was going to go with 'because windows'. – Sobrique Jun 25 '14 at 12:03
  • :-) it was definitely one of those periods in computing history that you had to live through to see just how much disaster it caused. – shawty Jun 25 '14 at 12:24
  • Thanks a lot @shawty your updated answer has certainly cleared up my understanding. I appreciate the time you put in very much. – Dave Williams Jun 25 '14 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.