When you sync SharePoint or OneDrive files to your computer, the sync process may stop with a file name too long error. This error occurs because Windows and OneDrive have a combined path length limit of 400 characters. The error prevents the folder or file from syncing and can block the entire sync queue.
The root cause is that SharePoint allows file paths up to 400 characters, but when syncing, the full local path (including your computer’s folder structure) exceeds this limit. This article explains how to identify and fix long file paths before they cause sync failures. You will learn specific steps to shorten folder names, restructure libraries, and use OneDrive settings to avoid the error.
Key Takeaways: Prevent File Name Too Long Error During Sync
- OneDrive sync app > Settings > Network: Enable file path length limit enforcement to block overly long paths before sync starts.
- File Explorer > Rename: Shorten folder and file names to 50 characters or fewer to keep the total path under 400 characters.
- SharePoint document library > Column sorting: Sort by Path Length column to quickly identify files that exceed the limit.
Why the File Name Too Long Error Occurs During Sync
The file name too long error happens because of the 400-character path length limit enforced by the OneDrive sync app. When you sync a SharePoint library to your computer, the sync app creates a local copy of the folder structure. The full path to a file includes your Windows user folder, the OneDrive root folder, the SharePoint site name, and all nested folders.
SharePoint itself supports paths up to 400 characters. However, the local path adds characters from your computer’s drive letter, user name, and OneDrive folder name. For example, a file at C:\Users\JohnDoe\OneDrive - Contoso\Shared Documents\Project Alpha\Reports\Q4\Final\draft-v3.docx contains 97 characters just from the local prefix. If the SharePoint-side path is 310 characters, the total exceeds 400 and sync fails.
The error appears as a red circle with a white cross in the OneDrive system tray icon. The sync app shows a notification stating “File name too long” and lists the affected file. The sync queue stops processing all files until you fix the path issue.
Character Limits for Different Sync Scenarios
The 400-character limit applies to the full local path. If you sync to an external drive or a network location, the path length may be shorter due to additional folder depth. The OneDrive sync app also limits individual file names to 255 characters. Folder names can be up to 250 characters, but combining many deep folders quickly consumes the path budget.
Steps to Identify and Fix Long File Paths
Use these steps to find files with long paths and shorten them before sync fails.
- Open OneDrive sync app settings
Right-click the OneDrive cloud icon in the system tray. Select Settings. Go to the Network tab. Under File path length limit, check the box that says “Enforce the 400-character path length limit.” Click OK. This setting prevents files with paths over 400 characters from syncing and shows a warning instead of a silent failure. - Check the sync status for long path warnings
In the OneDrive system tray icon, click the cloud icon and select View sync problems. The list shows files with path length errors. Note the full path of each blocked file. - Open the SharePoint document library in a browser
Go to the SharePoint site that contains the synced library. Navigate to the document library where the long-path files reside. Click the library name in the header and select Library settings. - Add the Path Length column to the library view
In Library settings, click Create column. Name the column “Path Length.” Choose Calculated as the column type. In the formula box, enter=LEN([Full Path]). Click OK. Go back to the library and add this column to your current view. The column displays the character count of each file’s SharePoint path. - Sort files by Path Length descending
Click the Path Length column header to sort from largest to smallest. Identify files with a path length above 350 characters. These files are at risk of exceeding the 400-character limit when combined with the local path prefix. - Shorten folder names and file names
For each at-risk file, rename folders or the file itself to reduce the total path length. Use abbreviations for folder names. For example, change “Quarterly Financial Reports” to “QtrFinancial.” Keep file names under 50 characters. After renaming, the Path Length column updates automatically. - Move files to a shallower folder level
If renaming is not enough, move files up one or two folder levels. Create a new folder at the root of the library with a short name. Move the deep files into that folder. Update any links or references to the new location. - Restart the OneDrive sync
After making changes, right-click the OneDrive icon and select Pause syncing for 2 hours. Wait 30 seconds, then click Resume syncing. The sync app re-evaluates all files and should process the shortened paths without error.
If SharePoint Still Has Issues After Shortening Paths
Sync still fails even after renaming files
If the error persists, the local path prefix may be longer than expected. Check your local OneDrive folder location. Go to OneDrive settings > Account tab > Choose folders. Note the root path shown under Your OneDrive folder. If your Windows user name is long or the drive letter is deep, consider moving the OneDrive folder to a shorter path. In OneDrive settings > Backup > Manage backup, click Change location and select a root folder like C:\OneDrive instead of C:\Users\LongName\OneDrive.
Folder names in SharePoint are too long to edit
If a folder itself has a name over 100 characters, SharePoint may refuse to rename it. In this case, create a new folder with a short name at the same level. Select all files from the long-named folder, click Move to, and choose the new folder. Delete the original empty folder after confirming all files moved.
OneDrive sync shows “Path too long” for a single file
A single file with a very long name can block the entire sync queue. Open SharePoint in a browser. Navigate to the file. Click the file name and select Rename. Shorten the name to 50 characters or fewer. The sync queue resumes processing other files within a few minutes.
| Item | SharePoint Path Limit | Local Sync Path Limit |
|---|---|---|
| Maximum total path | 400 characters | 400 characters (local prefix included) |
| Individual file name | 255 characters | 255 characters |
| Individual folder name | 250 characters | 250 characters |
| Default local prefix example | N/A | C:\Users\Name\OneDrive - Company\ (approx 40-60 chars) |
| Recommended max SharePoint path | 350 characters | 350 characters to leave room for local prefix |
After applying the steps in this article, you can prevent the file name too long error during sync. Start by enabling the path length enforcement in OneDrive settings. Then use the Path Length column in SharePoint to monitor and shorten deep paths. For ongoing management, set a naming convention that keeps folder and file names under 50 characters each. This practice reduces the chance of hitting the 400-character limit even as your library grows.