The file or folder name is too long SharePoint 2013/2016 / SharePoint Online / M365

Sharing is caring!

When migrating data from SMB, File Servers to Sharepoint online, You can face an error

The full error will appear as:

“The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.”

It is important to note that the total length of a URL equals the length of the folder or file path, including the protocol name, server name, folder or file name, and any parameters that are included as part of the URL.

So total URL = protocol + server name + folder or file path + folder or file name + parameters.

For example, a file was uploaded to a library in a SharePoint environment with the following URL:

http://myFarm/sites/mySite/mySubsite/myLibrary/myFolder/myParentFolder/myFile.txt

And the following values would be validated:

  • Filename: myFile.txt
    • Note: If the uploaded item had been a folder, the limits relating to a folder would have been applied instead.
  • Parent folder path : sites/mySite/mySubsite/myLibrary/myFolder/myParentFolder
  • Item full path: sites/mySite/mySubsite/myLibrary/myFolder/myParentFolder/myFile.txt

SharePoint imposes a limit on the number of characters that a file or folder path can have. The limits are as follows:

Validated pathSharePoint environmentMaximum length
Item or file nameOn-Premises128
Item or file nameMicrosoft 365/SharePoint 2019 (Insane Mode)400
Item or file nameMicrosoft 365/SharePoint 2019 (Normal Mode)400
Folder nameOn-Premises128
Folder nameMicrosoft 365/SharePoint 2019 (Insane Mode)400
Folder nameMicrosoft 365/SharePoint 2019 (Normal Mode)400
Document Set nameOn-Premises128
Document Set name – Content Type is not FolderMicrosoft 365255
Discussion Board title – Content Type is not FolderMicrosoft 365255
Parent folder pathOn-Premises256
Parent folder pathMicrosoft 365/SharePoint 2019 (Insane Mode)400
Parent folder pathMicrosoft 365/SharePoint 2019 (Normal Mode)400
Item full pathOn-Premises260
Item full pathMicrosoft 365/SharePoint 2019 (Insane Mode)400
Item full pathMicrosoft 365/SharePoint 2019 (Normal Mode)400
Folder full pathMicrosoft 365 (Insane Mode) on Create only255