Are there any (around 14) hidden characters in the path and/or filename in File Explorer?
Jul 28
I'm using Windows 11 Pro and D drive is basically an SSD. I've read that File Explorer has path + filename limit around 260 characters.
I personally can't verify it. Here's the issue:
This is the location where I'm creating a .txt file (18 characters) using Right Click > New > Text Document:
D:\Files\MISC\ABCD
And this is the .txt file name I'm trying to create (228 characters):
STARTmjXoUVCpeL8ND9YTaZGxJhqDbEMRrlsoQvyTWNzF76XcPADgKLDtBf3quRWnUke4JvYZpMHgTrNxyJQVCLazmKoUfDGWiRM8ptv6HqXyJAopDcwv9LdKXNgB27RsVZfqkTAYmhCDzEjolwNEsXVFq2gRUbKdyJzHaWTfMsnvcRqpDgtXKYZNAuRbtmzzzJQVCLazmKoUfGWiRM8ptvDzENDHERE.txt
The total visible characters now are 246. I can't add any more characters to file name. So I wonder if limit is indeed 260. Or maybe there are some hidden characters that I don't see in File Explorer. Like 14 hidden characters.
I read answers on many relevant questions here but I couldn't find any answer where this thing has been mentioned. The answers were more about limits and solving the limit issue or workarounds and understanding why there's limit on Windows.
However, I found two interesting questions for my concerns:
This question seems to have same scenario as me. The path + filename for this user has total characters around 245. Which is very close to me. But OP's concern there is not exactly same as mine so I don't get the answer there as well.
But then this question actually managed to create filename at a path and total visible characters are indeed close to 260. I am not able to create such longer names.
So the two questions I've shared above have further confused me. I don't really understand why there's this difference.
Are there indeed hidden characters around 14? If no, why am I not able to add extra 14 characters like the OP in other question apparently had done?
1 answer
Accepted answer · original discussion
Jul 29
This is a limitation applied by Explorer itself, not Windows. The same limitation also exists in Windows 10.
Without access to the source code, any attempt to answer this question would be purely speculative.
My hypothesis was that it has to do with Explorer adding “ - Copy” when a copy of a file is created in the same directory as the original. If a copy of a copy is created, the suffix changes to “ - Copy (2),” and so on. I thought that the remaining fourteen characters were reserved for this suffix—you know, some localized variants may be pretty long, and if it supports more than one hundred copies, this means that the digit could take three characters or more.
After some testing, it appears that this is not what happens. I started by creating a directory containing 220 characters (221, counting the trailing backslash)—this way, we can do our tests with relatively short file names. Then, I created a file with the longest name Explorer would allow me to do:
1234567890123456789012.txt—total: 247 characters.
(Same as you, but you got it off by one: the backslash between the directory and the file should count as a character.)
If I do Ctrl+C, Ctrl+V, I get:
12345678901234567 - Copy.txt—total: 249 characters.
By making another copy, I get:
12345678901234567 - Copy (2).txt—total: 253 characters.
Notice how the file name gets cut. Copying the file over and over to reach the counter of one hundred gives, indeed:
12345678901234567 - Copy (100).txt—total: 255 characters.
(and no, I won't continue until I reach a thousand, ten thousands, and one hundred thousand—the life is too short for that).
As “ - Copy” has a different length in languages other than English, let's try with Greek. It appears that the name is cut even more when the suffix is longer:
123456789012 - Αντιγραφή (2).txt—total: 253 characters.
I can go back to a copy and rename it, leading to:
12345678901234567890123 - Copy (2).txt—total: 259 characters.
123456789012345678 - Αντιγραφή (2).txt(same).
1234567890123456789012 - Copy (10).txt(same).
That's very close to the 260 characters limit. I would suppose that developers kept the remaining character for the trailing zero byte. Now, as I increased the directory full path to 240 characters (241, counting the separator character), I could create the following file inside:
12345678901234.txt—total: 259 characters.
And then, I could also copy it, leading to:
12345678901234 - Copy.txt—total: 266 (!) characters.
12345678901234 - Copy (2).txt—total: 270 characters.
There seemed to be no particular issues with this file. I could open it, rename it, and delete it without problems, which might give a hint that the actual limit is mostly useless in modern Windows, as Explorer seems to be using long paths under the hood anyway.
Likely it was implemented a long time ago, as a quick and dirty solution to handle most of the cases with long paths back when those were not supported by Explorer. Not a bad attempt, after all, given that there is no way to handle all the cases anyway. A user can always rename a parent directory to be longer, reaching the 260 characters limit for one of the children.
Now, there is one thing that worries me: I don't speak a word in Greek. How do I get Windows interface back to English?! That would be a good question to post on SuperUser!
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
Jul 28