When syncing files from SharePoint or OneDrive to your Windows computer, you might see an error message that says the file name is too long. This stops the sync process for that file and sometimes for the entire library. The error occurs because Windows has a maximum path length limit of 260 characters, and the full path including folder names exceeds this limit. This article explains why this limit exists, how to identify files that cause the error, and the steps to fix the problem by renaming files or moving them to shorter paths.
Key Takeaways: Fixing the File Name Too Long Sync Error
- Windows 260-character path limit: The root cause is the MAX_PATH limitation in Windows, which blocks file operations when the full path exceeds 260 characters.
- OneDrive sync app error message: The app displays a specific error indicating which file has the long path, allowing you to locate and fix it.
- Enable long path support in Windows 10 and 11: A Group Policy or registry setting removes the 260-character limit for modern applications, including the OneDrive sync app.
Why the File Name Too Long Error Happens During Sync
The error is caused by the MAX_PATH limitation in the Windows operating system. This limit restricts the total number of characters in a file path to 260 characters. The path includes the drive letter, colon, backslash, all folder names, the file name, and the file extension. For example, a file located at C:\Users\YourName\OneDrive - Company\Projects\2024\Q1\Marketing\Campaign\Assets\Images\Final\Header\background-image-v2-final.jpg can easily exceed 260 characters.
The OneDrive sync app respects this Windows limitation. When it tries to sync a file whose full path exceeds 260 characters, Windows returns an error. The sync app then stops processing that file and reports the error in the sync status. The file remains unsynced, and any changes to it will not be uploaded or downloaded until the path length is reduced.
This issue is more common in SharePoint document libraries because users often create deeply nested folder structures. A library with five or more levels of subfolders combined with long file names can quickly hit the 260-character limit. The error can also occur when syncing a large number of files at once, as the sync app processes the full path for each file.
Steps to Identify and Fix the File Name Too Long Error
- Check the OneDrive sync error notification
Open the OneDrive icon in the system tray. If there is a red circle with a white cross, hover over the icon to see the error message. Click the icon and select “View sync problems” to see the list of files that failed to sync. The error message will say “The file name is too long” and show the full path of the file. - Locate the file in SharePoint or OneDrive online
Open a web browser and go to the SharePoint site or OneDrive where the file is stored. Navigate to the folder path shown in the error message. You can copy the path from the error message and paste it into the browser address bar after the site URL to jump directly to the folder. - Rename the file to a shorter name
Select the file and click “Rename” in the toolbar. Change the file name to a shorter version. For example, changebackground-image-v2-final.jpgtobg-v2.jpg. Keep the file name under 30 characters if possible. This reduces the total path length. - Move the file to a shallower folder
If renaming is not enough, move the file to a folder closer to the root of the library. Cut the file and paste it into a top-level folder. You can also create a new folder with a short name at the root level and move the file there. - Restructure the folder hierarchy
For recurring issues, consider flattening the folder structure. Limit nesting to three levels deep. Use metadata columns and views in SharePoint to organize files instead of creating deep subfolders. For example, use a “Year” column and a “Project” column instead of folders like\2024\Q1\Marketing\Campaign\. - Enable long path support in Windows
In Windows 10 version 1607 and later, and in Windows 11, you can enable support for paths longer than 260 characters. This removes the limitation for applications that are aware of the setting, including the OneDrive sync app. To enable it, open Group Policy Editor by typinggpedit.mscin the Run dialog. Navigate to Computer Configuration > Administrative Templates > System > Filesystem. Double-click “Enable Win32 long paths” and set it to Enabled. Restart your computer. If Group Policy Editor is not available, use the registry: open Registry Editor and go toHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem. SetLongPathsEnabledto 1. Restart your computer. - Resume the sync after fixing
After renaming or moving the file, the OneDrive sync app should automatically retry the sync. If it does not, right-click the OneDrive icon in the system tray and select “Resume syncing”. You can also pause and resume sync from the same menu.
If the Sync Error Persists After Fixing File Names
Files still show the error after renaming
If the error continues, check if another file in the same folder also has a long path. The sync app reports one file at a time, but multiple files may be affected. Review the entire list of sync problems by clicking “View sync problems” in the OneDrive settings. Rename or move each file listed.
The error appears for files in the root of the library
If a file in the root folder shows the error, the file name itself is too long. File names should be kept under 100 characters. Rename the file to a shorter name. Also check if the local folder path on your computer is long. The full path includes the OneDrive folder location, which can add characters. For example, C:\Users\YourName\OneDrive - Company\ can be 40 characters or more. Move the OneDrive folder to a shorter path like C:\OneDrive\ by changing the OneDrive settings.
The error occurs only on a specific computer
If the same file syncs fine on another computer but fails on this one, the local path length differs. Check if the computer has a long user name or a deep folder structure in the OneDrive sync location. Shorten the user folder name by creating a new Windows user account with a short name and reconfiguring OneDrive under that account.
| Method | Effectiveness | When to Use |
|---|---|---|
| Rename the file | Quick fix for individual files | When only a few files have long names |
| Move file to shallower folder | Reduces path length without renaming | When folder names are long but file name is short |
| Restructure folder hierarchy | Prevents future errors | When the library has deep nesting |
| Enable long path support | Permanent system-wide fix | When users need deep folder structures |
After applying any of these methods, you can resume syncing the files that were blocked. The OneDrive sync app will process the corrected paths and upload or download the files successfully.