How do I auto shrink the folder path when migrating to OneDrive for Business or SharePoint Online?

How do I auto shrink the folder path when migrating to OneDrive for Business or SharePoint Online?

Answer:

When migrating to OneDrive for Business or SharePoint Online, the path length limitation is a common issue. OneDrive for Business and SharePoint Online have several limitations:
  • A given element (file or folder) cannot be more than 128 characters.
  • A total file path including full path + the file name cannot be more than 260 characters.
  • All of the characters have to be URL encoded, so many characters will actually count as three (3) characters. Therefore, often the limit can be reached faster than expected.
If encountering errors with "Request URL Too Long" or other issues related to folder names or file paths being too long, enable the Advanced Option ShrinkFoldersMaxLength=n where n is the maximum path length that can be tolerated before shrinking.

How does this Advanced Option work?

  • This option compresses a folder name by truncating the longest path elements iteratively, until matching the ShrinkFoldersMaxLength requirement. It truncates once it reaches ten (10) characters to try to keep some meaning in the folder name.
  • This option also truncates a folder path element when it is longer than 100 characters (OneDrive for Business or SharePoint Online). Even though the limit is 128, we have to keep a few characters free for special character + filename conflict management.
  • This option truncates files to 100 characters, for the same reason explained above, for folders.
  • This option can be used in conjunction with the Advanced Option "RenameConflictingFiles", which will manage conflicting files after truncation. Further details about this option can be found in KB005006.
  • Permissions will continue to be resolved properly after the folders and files have been renamed.
  • If a folder cannot fit the limit even after compression (for example, in the case of too many folder levels), MigrationWiz will report an error at the beginning of the migration.
We recommend that you set this Advanced Option as ShrinkFoldersMaxLength=200
Notes:
  • This option can be set to a higher or lower value, depending upon what is acceptable to the customer.  The value is dependent upon the following criteria: the file system data, the email address that is a part of the folder path (collection root), and the domain name for permissions, etc. However, using 200 should keep a good security range to manage all edge cases, and it provides a very reasonable limit.
  • This option should be enabled on a case-by-case basis. We recommend that you create a project specifically for when this option is required. Within this project, add the Advanced Option: ShrinkFoldersMaxLength=200 and then move mailboxes that get "path too long" errors into this project. It is not recommended to use it on every mailbox by default, as many mailboxes should be below the limit and being too aggressive may cause truncation, while normal migration may actually succeed. Further details on how to move items between projects can be found in KB004860.
  • If a former migration has been performed without the option on, then the storage will need to be reset at the Destination, otherwise, both file system structures will appear at the Destination.
  • If a user modifies the Source file system folder structure (for example, by renaming, removing, or creating a new folder) between two passes using this Advanced Option, the dynamic mapping may be totally different and the Destination may have two different file systems represented.
  • If multiple folders are truncated at 10 characters in the same parent folder, they may end up being merged into a single one if the first ten (10) characters are identical.
Was this article helpful?
0 out of 1 found this helpful