File Names Seem to Be Limited to Less Than 255 Characters



Symptoms

You may experience one or both of the following symptoms when you attempt to create a file in Windows:
  • When you attempt to use Windows Explorer or another program to create a file in a folder other than the root folder of a drive, the length of the file name seems to be limited to less than 255 characters. If you use Windows Explorer to move or copy a file with a very long file name to a folder other than the root folder of a drive, you may receive the following error message:
    Cannot copy <file name>. The file name you specified is invalid or too long. Specify a different filename.
  • When you attempt to use Windows Explorer to create a file in the root folder of a drive, the length of the file name seems to be limited to 250 characters.
These symptoms occur even though the Windows documentation states that a file name in Windows can include up to 255 characters.

Cause

Long file names are limited to 255 characters in Windows. However, the maximum path length in Windows is 259 characters. The maximum path length represents the length of the file name, plus the number of characters used to represent the drive and folder where the file is located. For example, the path length for the file C:\Windows\LongFileName.extension is 33 characters, but the file name is only 22 characters.

Because the path length is limited to 259 characters, a long file name is limited to less than 255 characters if more than five characters are needed to represent the drive and folder where the file is located. If five characters or less are needed to represent the drive and folder where the file is located, the long file name is limited to 255 characters, even if the total path length is less than 259 characters. For example, if a file is located in the root folder of a drive, the long file name is still limited to 255 characters, even though 256 characters could be used before the maximum path length is reached.

When you use Windows Explorer to create a file, the length of the file name is limited to 250 characters instead of 255 characters. This is a known problem that occurs with Windows Explorer in Windows. However, if you use another program to create a file with a file name longer than 250 characters, the entire file name is visible in Windows Explorer.

Status

Microsoft has confirmed that the 250-character file name limit on files created in Windows Explorer is a problem with Windows.

Download Long Path Tool 5.1.6 here