This File Cannot Be Synced Because the Path Is Too Long: OneDrive for Business Fix
🔍 WiseChecker

This File Cannot Be Synced Because the Path Is Too Long: OneDrive for Business Fix

OneDrive for Business stops syncing a file and shows the error “This file cannot be synced because the path is too long.” This happens because Windows and OneDrive have a combined character limit for the full file path, including the folder structure and file name. When the path exceeds 400 characters, OneDrive blocks the sync to prevent file system errors. This article explains why the limit exists, how to identify which files are affected, and the exact steps to rename or move files so they sync again.

Key Takeaways: Fixing the OneDrive Path Too Long Error

  • OneDrive sync status icon in File Explorer: Hover over the red or yellow icon to see the exact file path that exceeds the limit.
  • File Explorer search bar > length:>400: Use this search filter to find files with paths longer than 400 characters in your OneDrive folder.
  • PowerShell Get-ChildItem with Length property: Run a script to list all files with full paths exceeding 400 characters and export them to a CSV for bulk editing.

ADVERTISEMENT

Why OneDrive Blocks Files With Long Paths

OneDrive for Business enforces a 400-character limit on the full file path, which includes the drive letter, folder names, subfolder names, and the file name with extension. This limit comes from the Windows API that OneDrive uses to read and write files. When a file path exceeds 400 characters, OneDrive cannot create or update the file in the local sync folder, so it stops syncing that file and shows the error.

The error affects all file types, but it is most common with deeply nested folder structures, long folder names, or files with long names inside SharePoint document libraries synced via OneDrive. For example, a file at C:\Users\YourName\OneDrive - Company\Projects\2025\Q1 Marketing Campaign\Assets\Final\Approved\Version 3\Campaign_Brochure_Final_Approved_v3_2025_03_15.docx easily exceeds 400 characters.

OneDrive does not sync the file at all until the path is shortened. The file remains in the local OneDrive folder, but the sync status shows an error. Other files in the same folder continue to sync normally.

Steps to Find and Fix Files With Paths That Are Too Long

  1. Open the OneDrive sync status panel
    Right-click the OneDrive cloud icon in the system tray near the clock. Select View sync problems. This opens a list of all files that have sync errors, including the full path for each problematic file. Note the exact folder location and file name.
  2. Identify all long paths using File Explorer search
    Open File Explorer and navigate to your OneDrive folder. Click the Search box in the top-right corner. Type length:>400 and press Enter. File Explorer displays all files whose full path exceeds 400 characters. This search works in Windows 10 and Windows 11. You may need to wait a few seconds for the search to complete.
  3. Rename folders to shorten the path
    For each file listed in the search results, rename the deepest folder that has a long name. Use short, meaningful names like Q1Camp instead of Q1 Marketing Campaign. Avoid spaces and special characters. After renaming, the file path shortens by the number of characters you removed. OneDrive automatically retries the sync within a few minutes.
  4. Move files closer to the root of the OneDrive folder
    If renaming folders is not enough, move the file to a top-level folder inside your OneDrive. For example, move the file to OneDrive - Company\ShortName\ instead of keeping it seven levels deep. Cut the file and paste it into the new location. OneDrive syncs the file from the new path.
  5. Use PowerShell to export all long paths for bulk editing
    Open PowerShell as Administrator. Run this command to list all files with a full path longer than 400 characters in your OneDrive folder:
    Get-ChildItem -Path "C:\Users\YourName\OneDrive - Company" -Recurse -File | Where-Object { $_.FullName.Length -gt 400 } | Select-Object FullName, Length | Export-Csv -Path "C:\Temp\LongPaths.csv" -NoTypeInformation
    Open the CSV file in Excel. Sort by the FullName column. Rename or move each file based on the list.
  6. Verify the sync status
    After renaming or moving files, open the OneDrive sync status panel again. Confirm that the error no longer appears for those files. If the error persists, check that you shortened the path enough. The character count includes the drive letter, all folder names, and the file name.

ADVERTISEMENT

If OneDrive Still Shows the Path Too Long Error

Files are inside a SharePoint document library synced via OneDrive

SharePoint document library names are part of the path. For example, OneDrive - Company\SharePoint Site Name\Shared Documents\ adds many characters before your folder structure. Shorten the folder names inside the document library. You can also sync only a specific subfolder instead of the entire library. In OneDrive settings, go to Sync and backup > Manage backup > Choose folders and select only the folders you need.

OneDrive sync is stuck and does not retry

If OneDrive does not retry syncing the fixed files after 15 minutes, pause and resume sync. Right-click the OneDrive cloud icon and select Pause syncing for 2 hours. Then click Resume syncing. This forces OneDrive to re-evaluate all files.

The file path still exceeds 400 characters after renaming

Count the characters in the full path. Open the file properties in File Explorer, copy the full path from the Security tab or Details tab, and paste it into a text editor that shows character count. Remove characters until the path is under 400. You may need to rename multiple parent folders or move the file to a shallower location.

Item Manual Rename in File Explorer PowerShell Bulk Rename
Best for One or two files with long paths Hundreds of files with long paths
Time required 2 to 5 minutes per file 10 minutes to write and run the script
Risk of data loss Low, because you rename files one at a time Medium, if the script renames the wrong files
Requires admin rights No Yes, to run PowerShell

You can now find and fix files that OneDrive blocks due to long paths. Next time you create a folder structure inside OneDrive, keep folder names under 20 characters and limit nesting to three levels. Use the length:>400 search in File Explorer as a regular maintenance step to catch long paths before they cause sync errors.

ADVERTISEMENT