File names too long - issue with NTFS filename compliance

Hi

NextCloud 10.0.1 is giving sync errors as NTFS file names are too long. NTFS sets limits to 255 characters, and the total path length is limited to approximately 32,000 characters.

Is there a way, I could tweak NextCloud to accept the NTFS filename format please or is this a db issue.

With best regards

Fab

1 Like

Sorry, I can’t help you directly on your question.

But I had some experience with the 260 Byte Limit of Windows Pathnames.

NTFS itself has a limit of 32767 characters - so the filesystem is not the problem.

The Win32 API - that are the functions which are used by php, other language runtimes like C, C#, python, Java to access the files on Windows does have two interfaces:

  1. the ansi interface, which is limited to 260 characters including Driveletter, Colon and as far as I know the string-terminating NULL character.
  2. the Unicode interface - limits to 32767 characters, but only in the case the path is prefix with a special string “\\?”. If the prefix is missing, than the limit is 260 characters.

For more details you might have a look at:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath

But even if you are able to store long path directories and files on NTFS most Windows applications are not able to handle them properly (java apps can, normal Windows Explorer (this also includes the SHELL File-Open Dialogs which is used by nearly every application) is NOT able to handle the \?\ prefix.

Maybe that some things may change in the future: have a look at the remark on Windows 10 version 1607 they have removed the limit, but well written applications are checking the length of a path using the macro MAX_PATH which needs a recompile of the applicatoin and Windows Version specific checking afterwards (the new functionality is implemented as Opt-in :frowning: ).

You may workaround about the problem by using symbolic links on Windows…

Where did you obtain the limit - on server side or on client side?

regards

Peter

Hi Peter

Thanks for the info, the limit came from the server side, hence I was thinking that the issue might be either a NextCloud Configuration issue or a mysql issue.

1 Like

well, it depends how long the Pathnames are.

As I already discussed above Windows has a more or less hard limitation of 260 Bytes maximum Pathlength. This can only be overcome, when running on Windows 10 version 1605 or a Windows Server 2016 by setting this one parameter shown in the link above. If your application is using internally unicode API, the it is possibly also able to use the \\?\ prefix - then you are fine.

Each file in the cloud is stored on the webservers data directory (there is a default destination which can be overwritten by the config.php parameter datadirectory).

Let’s assume that this looks like %PRGORAMDATA%\NextCloud\Data (which will typically result in c:\ProgramData\NextCloud\Data

Nextcloud now creates a root directory on top on this path for every user (example Max.Mustermann), files and the complete path is stored in a subfolder files.

So the first file (example: first.file) would be located in c:\ProgramData\NextCloud\Data\Max.Mustermann\files\first.file
which are alread 61 Bytes of the 260 possible one.

You may give it a try to use the prefix
"\\?" on the value of the datadirectory parameter. If php is working internally using unicode, then you have a good chance that you then can use a file path on the server which has more than 260 Bytes. (please first try this on a test system)

Otherwise you have only the possibility to use symbolic links to shorten the path of the datadirectory “c:\ProgramData\NextCloud\Data”, but this will only help marginally.

Kind regards

Peter

Long Path Tool is a software that will let you easily delete, copy or rename long path files.

Same situation was for me before but when i installed Long Path Tool, my computer became free from any problems

I too had this error when copying deeply nested files. First I tried to cut off the file names then I soon realized that this idea is not feasible. After searching a lot on the internet I found that GS Richcopy 360 had good reviews and I tried it. Currently I am using it and now I don’t have any issues regarding this issue. You can also try it, it helps!

Hello.
I have a related issue : I am exposing a share from a windows server over SMB through Nextcloud, using the external storages. However, files that have a path length that is too long do not show up in Nextcloud.

Thoughts?

I had the same issue with my file error because their names are too long then someone suggested me LongPathTool and it was a king of magic happened and all of my problems have been solved

260 get me ?
Yeah it can be a real headache, I tried LongPath Tool Program which helped a lot.

wwe: close old topics