I'm designing a database table which will hold filenames of uploaded files. What is the maximum length of a filename in NTFS as used by Windows XP or Vista?
I'm designing a database table which will hold filenames of uploaded files. What is the maximum length of a filename in NTFS as used by Windows XP or Vista?
Individual components of a filename (i.e. each subdirectory along the path, and the final filename) are limited to 255 characters, and the total path length is limited to approximately 32,000 characters.
However, on Windows, you can't exceed MAX_PATH value (259 characters for files, 248 for folders). See http://msdn.microsoft.com/en-us/library/aa365247.aspx for full details.
It's 257 characters. To be precise: NTFS itself does impose a maximum filename-length of several thousand characters (around 30'000 something). However, Windows imposes a 260 maximum length for the Path+Filename. The drive+folder takes up at least 3 characters, so you end up with 257.
199 on Windows XP NTFS, I just checked.
This is not theory but from just trying on my laptop. There may be mitigating effects, but it physically won't let me make it bigger.
Is there some other setting limiting this, I wonder? Try it for yourself.
According to MSDN, it's 260 characters. It includes "<NUL>" -the invisible terminating null character, so the actual length is 259.
But read the article, it's a bit more complicated.
This part of the official documentation says clearly that it’s 255 Unicode characters for NTFS, exFAT and FAT32, and 127 Unicode or 254 ASCII characters for UDF.
Apart from that, the maximum path name length is always 32,760 Unicode characters, with each path component no more than 255 characters.
255 chars, though the complete path should not be longer than that as well. There is a nice table over at Wikipedia about this: http://en.wikipedia.org/wiki/Filename.