When you migrate files to SharePoint using the SharePoint Migration Tool, some files may be skipped without an obvious error. The migration log shows a warning that the file path exceeds 400 characters. This happens because Windows and SharePoint enforce a maximum path length limit that the tool respects. This article explains why the SharePoint Migration Tool skips long path files and provides a fix to resolve the issue.
Key Takeaways: Fixing Long Path File Skipping in SPMT
- SharePoint Migration Tool Logs > Path Length Warning: Identifies files skipped due to paths exceeding 400 characters.
- Enable Long Path Support in Windows Registry: Modifies the system to allow paths longer than 260 characters before migration.
- Shorten Source Folder Structure: Reduces folder depth on the source to prevent path length issues before running SPMT.
Why the SharePoint Migration Tool Skips Files with Long Paths
The SharePoint Migration Tool uses the Windows file system API to read source files. By default, Windows has a maximum path length of 260 characters, known as MAX_PATH. This limit applies to the total path from the drive letter to the file name, including backslashes. When a file path exceeds 260 characters, the Windows API cannot access the file, and SPMT skips it.
SharePoint Online itself supports paths up to 400 characters in a document library. However, the migration tool must first read the file from the local source. If the source path is longer than 260 characters, the tool cannot open the file to upload it. The migration log records a warning with the message “The file path is too long” and the file is skipped.
This limitation is not a bug in SPMT. It is a constraint of the underlying Windows file system. The same issue occurs when you try to copy, move, or delete a file with a path longer than 260 characters in File Explorer. The fix requires either enabling long path support in Windows or shortening the source folder structure before migration.
Steps to Fix the Long Path File Skipping Issue
There are two methods to resolve this problem. Method 1 enables long path support on the Windows machine where SPMT runs. Method 2 reduces the folder depth on the source drive. Use Method 1 if you cannot change the source folder structure. Use Method 2 if you prefer to avoid registry changes.
Method 1: Enable Long Path Support in Windows
- Open the Registry Editor
Press Windows key + R, type regedit, and press Enter. Click Yes if prompted by User Account Control. - Navigate to the LongPathsEnabled key
In the left pane, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem. Scroll down to find the LongPathsEnabled entry. - Modify the value to 1
Double-click LongPathsEnabled. Change the Value data from 0 to 1. Click OK. - Restart the computer
Close Registry Editor and restart your computer. This change enables long path support for all applications that opt in, including SPMT. - Run SPMT again
Open the SharePoint Migration Tool and start the same migration task. Files with paths up to 32,767 characters can now be read and uploaded.
Method 2: Shorten the Source Folder Structure
- Identify folders with deep nesting
Open the source folder in File Explorer. Look for folders nested more than 5 levels deep. Each folder level adds to the path length. - Move files to a shorter root folder
Create a new folder directly on the drive root, for example C:\Migrate. Copy the files and folders from the deep location into this new folder. This reduces the starting path length. - Rename folders to shorter names
If moving files is not possible, rename folders to single characters or numbers. For example, rename “Department of Finance and Accounting” to “FinAcct”. This reduces the total path length. - Remove unnecessary intermediate folders
Delete folders that serve no purpose, such as “Archive” or “Old” inside a deep structure. Combine multiple empty folders into one. - Run SPMT with the shortened source path
Point SPMT to the new shorter folder location. Verify that no files are skipped due to path length.
If the Migration Tool Still Skips Files After the Fix
SPMT Log Shows File Path Still Too Long
If you applied Method 1 but files are still skipped, confirm that the registry change took effect. Open Registry Editor again and verify that LongPathsEnabled is set to 1. Also, ensure you restarted the computer after the change. Some older versions of SPMT may not support long paths. Update SPMT to the latest version from the Microsoft Download Center.
File Name Contains Invalid Characters
A file with a valid path length may still be skipped if its name contains characters that SharePoint does not allow. Invalid characters include ~ # % & : < > ? / \ |. Rename the file on the source to remove these characters before running SPMT again.
SPMT Reports Access Denied for the File
If the file path is short enough but SPMT cannot read the file, check the file permissions. Right-click the file, select Properties, go to the Security tab, and verify that your account has Read permission. If not, take ownership of the file or ask the administrator to grant access.
| Item | Registry Change (Method 1) | Folder Restructure (Method 2) |
|---|---|---|
| Effect on source files | None | Moves or renames files |
| Requires admin rights | Yes | No |
| Requires reboot | Yes | No |
| Works for all future migrations | Yes | No |
| Risk of breaking other apps | Low | None |
You can now run the SharePoint Migration Tool without files being skipped due to long paths. If you enabled the registry change, remember to set LongPathsEnabled back to 0 after the migration if you do not need long path support for other applications. For ongoing migrations, consider using the SharePoint Migration Tool with PowerShell scripts that include a path length check before the transfer.