Can’t open files with 103 char filenames, 259 char paths
-
Couldn’t find any references to this issue in the help or forums, but is there a known issue with opening files with certain filename lengths, with path lengths possibly being a factor? I can’t seem to open files that have 103 characters in the filename here, where the total path length is 259 characters, neither by menu File > Open, nor by drag-and-drop from file manager. If I rename the file so that its name is either 102 or 104 characters, it opens just fine, but at 103 characters, nothing happens, no error message, nada. If I move the file to the root folder, or closer to it, it also opens fine. I’ve also tried variations, such as 99 characters followed by dot and filename extension, and 103 characters with no extension. Some examples:
“asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt”
“asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmqrtxt”Reproducible by any other users?
Debug info:
Notepad++ v7.9.3 (32-bit)
Build time : Feb 14 2021 - 03:12:31
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : ON
Local Conf mode : OFF
OS Name : Windows 7 Ultimate (64-bit)
OS Build : 7601.0
Current ANSI codepage : 1252
Plugins : ComparePlugin.dll DSpellCheck.dll ElasticTabstops.dll ExtSettings.dll MathPad.dll mimeTools.dll MultiClipboard.dll NppCalc.dll NppConverter.dll NppExport.dll NPPJSONViewer.dll NppTextFX.dll NppXmlTreeviewPlugin.dll PythonScript.dll RegexTrainer.dll SessionMgr.dll -
@M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
If tried it with two places.
D:\Tests\npp\_latest\x64_clean\asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
and
C:\Users\XXXXXX\AppData\Local\Temp\test\test2\test3\test4\asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
It worked for me.
Can you specify a path where it doesn’t open? -
I can’t reproduce it with a path like this “E:\tmp\1111111111111111111111111111111111111111111111\2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt”.
Also, try with disabled plugins. For that, you can launch with-noPlugin
command line option: https://npp-user-manual.org/docs/command-prompt/ -
@Ekopalypse said in Can’t open files with 103 char filenames, 259 char paths:
Can you specify a path where it doesn’t open?
@mere-human said in Can’t open files with 103 char filenames, 259 char paths:
Also, try with disabled plugins.
The following file/location doesn’t work here, with or without plugins disabled:
T:\Tests\Test\12345\12345678901\123456789012345678\12345678901234567890123456789012345678901234567890123456789012\12345678901234567890123456789012345678901\asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
-
@M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:
T:\Tests\Test\12345\12345678901\123456789012345678\12345678901234567890123456789012345678901234567890123456789012\12345678901234567890123456789012345678901\asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
I first create the folder via the PythonScript console window:
>>>os.makedirs(r'T:\Tests\Test\12345\12345678901\123456789012345678\12345678901234567890123456789012345678901234567890123456789012\12345678901234567890123456789012345678901')
That’s successful so I create a
new 2
file, change it, and then do Ctrl+s and specify:T:\Tests\Test\12345\12345678901\123456789012345678\12345678901234567890123456789012345678901234567890123456789012\12345678901234567890123456789012345678901\asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
In Explorer, I can see that file now.
But doing a File Open and pasting the entire path in the box results in nothing happening when I press Enter. Well, the dialog closes, but no file is loaded.
Also, if I use the File Open dialog to open the containing folder, that works and I can see the file, but trying to open it from there results in nothing happening as well.
So for me, the OP’s problem occurs.
-
For a related discussion, see https://community.notepad-plus-plus.org/topic/18372/long-paths-support
-
@Alan-Kilborn , thanks for confirming.
@PeterJones , interesting info, thanks. It would have been easy for me to assume that my problem was strictly a path-length issue, but that seems to have been ruled out by the fact that I was able to add a character to the filename, and then it successfully opened in NPP. However, I just tried that again here, and it did NOT open. I’ve now created a series of copies with successively longer filenames. These (first one is my original 103-char name; all attempted from same path location as in my last post) did NOT open:
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq1.txt
These DID open:
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq12.txt
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq123.txt
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq1234.txt
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq12345.txt
-
Ok I see. Can somebody create an issue on GitHub? Or maybe, there is one already.
-
@M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:
asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnm1234567890asdfghjklqwertyuiopzxcvbnmq.txt
On windows7 x64 I can confirm the problem with the 259 long path. Another editor can open it. But I am not able to create longer filenames, windows7 refuses to let me do that.
-
So just what are the filename and pathname length limits these days (Win10, and to a lesser interest, Win7)? One would argue “Why should there be a maximum?”
Do these correspond with what Notepad++ can handle?
Maybe I’m just posing questions, not actively seeking answers… :-)
-
-
Well, that’s the standard answer – the company line, so to speak.
Does it conform to reality?
I mean, if the OP is to be believed (no reason to doubt him), he was able to open longer paths than the one “right on the border” that was giving him trouble.
Of course, I tried his longer paths and couldn’t open those (Win10).Also curious about “really lengthening the limit” as described in your link.
I wonder if it fully works for Notepad++.
Meaning that the link lists API function names, does Notepad++ only use those? Likely not.
Of course I’m sure that N++ source code is full of usage of MAX_PATH in declaring buffer sizes for paths, anyway… -
@Alan-Kilborn said in Can’t open files with 103 char filenames, 259 char paths:
Does it conform to reality?
Maybe, maybe not. Who controls the matrix?? Neo?? Me :-D
I mean, if the OP is to be believed (no reason to doubt him), he was able to open longer paths than the one “right on the border” that was giving him trouble.
Of course, I tried his longer paths and couldn’t open those (Win10).Also curious about “really lengthening the limit” as described in your link.
I wonder if it fully works for Notepad++.
Meaning that the link lists API function names, does Notepad++ only use those? Likely not.Not sure one has already bothered to test this…
Of course I’m sure that N++ source code is full of usage of MAX_PATH in declaring buffer sizes for paths, anyway…
Yeah, currently, 278 matches found.
-
@mere-human said in Can’t open files with 103 char filenames, 259 char paths:
Ok I see. Can somebody create an issue on GitHub? Or maybe, there is one already.
I thought that someone had during the old discussion I linked to, but I couldn’t find one. I searched for “long path” in the issues, and found https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9181 , which appears to be related. I added links to this topic and the other one I mentioned in the issue.
-
@Ekopalypse said in Can’t open files with 103 char filenames, 259 char paths:
I am not able to create longer filenames, windows7 refuses to let me do that.
Confirmed here, when using Windows Explorer I am neither able to copy files with names longer than 103 characters to my long T:\ path, nor rename them to longer names in place. For the record, the file manager I normally use is Directory Opus, which is evidently able to do both.
Note that once these files have been created/copied-to/renamed in DOpus, I can open an Explorer window, navigate to their location, and they are all correctly displayed there. Noteably, I can drag-and-drop all but the 103-char-name file onto my NPP window, and they open.
Also, noteably, in the current phase of this test, NPP will NOT open the 103- or 104-char-name files when drag-and-droppped from DOpus, but it DOES open the 104-char-name file via Ctrl+O. All longer filenames I’ve tried open by either method so far.
I should also mention that every long filename+path I’ve tried so far has successfully been opened in regular Windows Notepad.
Would it be useful for me to 7-zip my batch of test files (103–110 character names) in their long path and upload it somewhere?
@Alan-Kilborn said in Can’t open files with 103 char filenames, 259 char paths:
I tried his longer paths and couldn’t open those (Win10).
Just clarifying: You were able to create/copy/rename to longer filenames, but not open in NPP? Did you try both drag-and-drop and Ctrl+O?
-
Uploading, not sure if that help here but might be helpful for the git issue.
Curious, can you check yourLongPathsEnabled
registry key from
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
? -
@M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:
Would it be useful for me to 7-zip my batch of test files (103–110 character names) in their long path and upload it somewhere?
Probably. How about the most-appropriate issue that @PeterJones cited.
You were able to create/copy/rename to longer filenames, but not open in NPP? Did you try both drag-and-drop and Ctrl+O?
I did try both drag-and-drop and
File
>Open
(dialog) approaches, but probably not on rigorously on each and every file. Just did some spot-checking.My directory manager program (XYPlorer) colors in red paths that are “too long”. Interestingly, your original complaint file it leaves non-red but one character longer and it colors it red.
I suppose Notepad++ could have trouble with your original file because…and this is a big MAYBE…it might declare
buffer[MAX_PATH]
instead ofbuffer[MAX_PATH+1]
. The+1
being some fudge room for a C-string null-terminator. OK, my C/C++ days are coming flooding back now, so before I get into trouble I’ll stop. :-) -
but that is what notepad++ should do accroding to MS documents. To quote:
In the Windows API (...), the maximum length for a path is MAX_PATH, which is defined as 260 characters.
and further
For example, the maximum path on drive D is "D:\some 256-character path string<NUL>" where "<NUL>" represents the invisible terminating null character for the current system codepage.
I hope my math 3+256+NUL = 260 is now correct. :-D
-
@Ekopalypse said in Can’t open files with 103 char filenames, 259 char paths:
Curious, can you check your
LongPathsEnabled
registry key from
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
?No such key exists on my Windows 7 system, and I don’t believe it’s supported until Windows 10, version 1607. See:
https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
-
@M-Andre-Z-Eckenrode said in Can’t open files with 103 char filenames, 259 char paths:
No such key exists on my Windows 7 system, and I don’t believe it’s supported until Windows 10, version 1607
So then really there’s not much for you as a Win7 user to say about your original “problem”, I think. It’s a limitation of the OS, not Notepad++, that you can’t open your really-long-named files.