Search code examples
node.jsfilewindows-10

Is there a way to have really long file names in Windows 10 and have they renamed by a script?


I am currently trying to have ffmpeg create files with names that are ~1000 characters, I have enabled "LongPathsEnabled" in the Windows and rebooted multiple times but neither ffmpeg nor windows file explore seems to want to name anything that long. I have also tried to rename the files from a script (specifically nodejs) and nothing seems to work and I keep getting "invalid file name" errors.

Is it simply not possible to rename files that long in the windows file system, is "LongPathsEnabled" just for the path itself. Please help if you think you have anything relevant, thank you.


Solution

  • LongPathsEnabled allows a complete PATH to be up to 32767 characters. A single component of that path is still limited to 256. The directory table in the NTFS file system has a field for the name's length, and it is one byte. This is a hard limit that cannot be overridden without upgrading to Linux.

    Here's an exchange that discusses it:

    Maximum filename length in NTFS (Windows XP and Windows Vista)?

    And here's the MSDN page that specifies it, which is surprisingly hard to find:

    https://learn.microsoft.com/en-us/windows/win32/fileio/filesystem-functionality-comparison#limits