OneDrive Migration Tool Skips Long Paths: OneDrive for Business Fix
🔍 WiseChecker

OneDrive Migration Tool Skips Long Paths: OneDrive for Business Fix

When you migrate files to OneDrive for Business using the Microsoft Migration Manager or the OneDrive sync app, some files and folders may not move because their file paths exceed the Windows maximum path length of 260 characters. This limit, also called MAX_PATH, causes the migration tool to skip those items without warning. This article explains why the migration tool stops on long paths, how to identify the affected files, and the exact steps to fix the issue so all your data moves successfully.

Key Takeaways: Fixing OneDrive Migration Tool Long Path Errors

  • Migration Manager reports > Skipped items: Shows the exact file paths that exceeded the 260-character limit, enabling targeted remediation.
  • PowerShell script to shorten paths: Use Get-ChildItem and Rename-Item to reduce folder and file name lengths below the threshold before re-running migration.
  • Windows Group Policy > Enable NTFS long paths: Allows the migration tool to handle paths up to 32,767 characters, but requires a reboot and migration tool restart.

ADVERTISEMENT

Why the OneDrive Migration Tool Skips Long File Paths

The Windows NTFS file system supports paths longer than 260 characters, but many legacy applications, including parts of the OneDrive migration infrastructure, still enforce the old MAX_PATH limit. When the migration tool encounters a file whose full path—including drive letter, folders, subfolders, and file name—exceeds 260 characters, it logs the file as skipped and continues to the next item. It does not block the entire migration, but the skipped files remain in the source location.

The root cause is almost always deeply nested folder structures combined with long file names. For example, a folder named “Marketing Campaign Q4 2024 Final Assets” inside “Shared Drive Archive” inside “Corporate Files” can easily push a simple file name like “Presentation_Draft_v3_Feedback_Edits.docx” past 260 characters. The migration tool does not automatically shorten paths or move files to a shallower location.

Where the Limit Applies

The 260-character limit applies to the absolute path on the source file server or local drive. OneDrive itself, once files are in the cloud, has a limit of 400 characters for the full URL path, but the migration tool uses local path resolution first. The limit does not apply to files stored directly in SharePoint document libraries when accessed via the web, but it does apply during the migration upload process.

Steps to Identify and Fix Long Path Files Before Migration

Before you run the migration tool again, you must locate every file with a path longer than 260 characters and either shorten the path or enable long path support on the source machine.

Method 1: Use PowerShell to Find Long Paths

  1. Open PowerShell as Administrator
    Press the Windows key, type “PowerShell”, right-click Windows PowerShell, and select Run as administrator.
  2. Run the path length scan command
    Type the following command and press Enter:
    Get-ChildItem -Path "C:\SourceFolder" -Recurse -Force | Where-Object { $_.FullName.Length -gt 260 } | Select-Object FullName, Length
    Replace “C:\SourceFolder” with the actual root folder you are migrating. This command lists every file and folder whose absolute path exceeds 260 characters. The Length column shows the character count.
  3. Export the list to a CSV file
    Add | Export-Csv -Path "LongPaths.csv" -NoTypeInformation to the end of the command. Open the CSV in Excel to review each path and plan the rename.

Method 2: Shorten Folder and File Names

  1. Rename deep folders to shorter names
    Identify folders deeper than five levels from the root. Rename them to three or four characters, such as “Mktg” instead of “Marketing Campaign Q4 2024 Final Assets”. Use File Explorer or a PowerShell Rename-Item loop for bulk changes.
  2. Shorten file names
    Reduce file names to 20 characters or fewer. For example, rename “Presentation_Draft_v3_Feedback_Edits.docx” to “Pres_v3_fb.docx”. Avoid special characters that add length.
  3. Flatten the folder structure
    Move files from deeply nested subfolders into a parent folder with a short name. This reduces path length without renaming every file.
  4. Re-run the path scan
    Run the PowerShell command again to confirm no paths exceed 260 characters before starting the migration.

Method 3: Enable Long Path Support via Group Policy

  1. Open Local Group Policy Editor
    Press Windows key + R, type gpedit.msc, and press Enter.
  2. Navigate to the long path setting
    Go to Computer Configuration > Administrative Templates > System > Filesystem. Double-click “Enable Win32 long paths”.
  3. Enable the policy
    Select Enabled and click OK. This setting allows Windows and applications that support the extended path prefix to handle paths up to 32,767 characters.
  4. Reboot the machine
    Restart the computer for the policy to take effect. The OneDrive Migration Tool must also be restarted to recognize the new limit.

ADVERTISEMENT

If the Migration Tool Still Skips Files After Fixing Paths

OneDrive Migration Tool Reports “Path Too Long” Even After Renaming

If the tool still skips the same files, the issue may be a hidden folder or a system file attribute. Run the PowerShell command with the -Force parameter to include hidden and system items. If a hidden folder has a long path, unhide it temporarily, rename it, and then re-hide it after migration.

OneDrive Sync App Stops During Upload of a Long Path File

The OneDrive sync app itself has a 400-character limit for the full URL path, but the local sync engine may still enforce the 260-character limit for the local cache path. If you are using the sync app as a migration method, enable long path support in Windows using the Group Policy method above, then restart the sync app. If the file still fails, use the SharePoint Migration Tool (SPMT) instead, which handles long paths more reliably.

OneDrive Migration Tool vs PowerShell Rename: Key Differences for Long Paths

Item OneDrive Migration Tool PowerShell Rename-Item
Path limit handling Skips files above 260 characters by default; no automatic rename Can rename files with paths up to 32,767 characters if long path support is enabled
Bulk operation Migrates files in parallel; reports skipped items in a log Processes one file at a time; requires a loop for bulk actions
Risk of data loss Low; skipped files remain in source Moderate; incorrect rename can break file references if used without testing
Best use case Initial migration of large file shares Pre-migration cleanup to reduce path lengths

You can now identify files with paths longer than 260 characters, rename or restructure them, and re-run the OneDrive Migration Tool without skipping items. Next, check the migration completion report in the Microsoft 365 admin center to verify that no files were left behind. As an advanced tip, schedule a weekly PowerShell script that scans your file shares for paths approaching 250 characters so you can fix them before the next migration cycle.

ADVERTISEMENT