One or more files in the restored site collection will exceed the maximum supported path length. Please select a shorter destination site address and try again.

One or more files in the restored site collection will exceed the maximum supported path length. Please select a shorter destination site address and try again.

  • Comments 6

I had a customer encounter an error while trying to restore a site collection using STSADM -O RESTORE.   They had backed up the site collection without error from the same farm, but when they tried to restore the site collection using a new URL to the same farm, STSADM gave them the following error:

One or more files in the restored site collection will exceed the maximum supported path length. Please select a shorter destination site address and try again.

After some investigation I found out, as the error message alludes to, the path we are trying to restore to is violating the 260 character path length restriction in SharePoint.  There are a few tables in the database that can trigger a violation of the path length, in our case it was in the docs table.  In our scenario, the original URL was sites/abc.  In this site collection, we have a document library with a nested folder structure, the longest folder path being 259 characters, just under the 260 limit.  The URL we used to restore the site collection backup to was sites/abcxyz, three characters longer than the original URL.  These extra three characters made our 259 character folder path in the original URL, 262 characters, which is over the 260 character limit, causing the error to be thrown.

To understand the root of the problem, I kept digging and finally tracked the error down to the proc_RenameSite stored procedure, which is called AFTER the process restores all the content to the content database.  The bad part about the AFTER statement, is that if you have a large site collection (10’s of GBs), you will likely be waiting a several hours for the restore process to reach this point in the process, have it error out and roll back the restore and exit, leaving you in a very “happy” mood. 

You have a couple courses of action to work around this problem.  The easiest, but not always practical, method is to shorten the name of the site collection you are restoring, something like sites/sweng instead of sites/software_engineering, giving you 15 extra characters in your folder paths.  Second, if you still have the original site collection available, you could rename some folders, files, etc, to shrink the URL length well below the 260 character limit, so you have the extra characters available for your restored site URL.  Finally, if you do not have the original site collection available to you, and you cannot choose a shorter URL for your restored site, you could run the restore processing again, choosing a temporary short site collection URL, like sites/x, rename some of the longer paths in your site collection, backup the sites/x site collection, and try the restore again using your desired URL.  It’s not a pretty or easy method, but it may be your only solution.

Here is a bit of SQL that you can use to examine your DOCS table in the content database, to look for long paths.  The Total column is the combination that cannot exceed 260 characters.

SELECT
    LEN(DirName + N’/' + LeafName) AS Total, 
    DirName,
    LeafName
FROM
    Docs WITH (NOLOCK)
ORDER BY Total DESC

Leave a Comment
  • Please add 7 and 5 and type the answer here:
  • Post
Page 1 of 1 (6 items)