What can I do if Windows File Explorer indicates that a file name is too long?

What can I do if Windows File Explorer indicates that a file name is too long?

Symptoms

When using Windows File Explorer to rename a file on your Synology NAS with a file name that is allowed in File Station, you encounter an error message saying "The file name you specified is not valid or too long. Specify a different file name."
3.png

Diagnosis

This issue occurs because your file path length exceeds 244 characters, which could result from a long file name, long parent folder names, or having many layers of parent folders.

According to Windows regulations for files and folders on network drives, the maximum path length (MAX_PATH) for the Windows API is 260 characters. This includes a drive letter (e.g., E:\ taking up 3 characters), a folder path, a file name, and an invisible terminating NULL character (taking up 1 character).

Excluding the drive letter and the terminating NULL character, the maximum path length for creating, renaming, or moving a file/folder on a network drive is 244 characters.1 Exceeding this limit will prevent file operations such as saving, renaming, moving, or deleting.2
4.png

Resolution

  1. Move the file you want to rename to one of its parent folders to shorten the path length.
  2. Rename the file and make sure the new path is within 244 characters.3

Notes:

  1. The maximum usable path length is 244 characters as Windows File Explorer reserves 12 characters for the 8.3 file name format.
  2. This restriction applies only to Windows File Explorer and the Windows API. It does not affect file renaming with the ren or rename commands in Windows PowerShell or Command Prompt.
  3. You can use this website to count the number of characters in a file/folder name or a path.
Symptoms
Diagnosis
Resolution
Further reading