How to find and sync files with long destination paths

Louis Heath 20 Reputation points
2026-07-06T07:32:54.67+00:00

So I’m uploading my last two years of work to one drive, about 280gb. I’ve run into an issue where several (I estimate hundreds) of the file destination paths are too long so they didn’t sync. Wondering what then best solution to finding these files would be so I can manually add them?

Any ideas or alternative solutions would be much appreciated.

Microsoft 365 and Office | OneDrive | For business | Windows
0 comments No comments

Answer accepted by question author
Anonymous
2026-07-06T08:07:07.04+00:00

Hi Louis Heath

You can use the PowerShell script below to identify files whose full path exceeds 350 characters. Running this script with administrator permissions will generate a list of file paths that are approaching OneDrive's 400-character path length limit. 

Get-ChildItem -Path "C:\Your\Source\Folder" -Recurse -ErrorAction SilentlyContinue | 
Where-Object { $_.FullName.Length -gt 350 } | 
Select-Object FullName, @{Name="Length";Expression={$_.FullName.Length}} | 
Export-Csv -Path "C:\TooLongPaths.csv" -NoTypeInformation 

Please note that the 400-character limit includes both the complete folder path and the file name. As a result, even when the file name itself is relatively short, a deeply nested folder structure can cause the total path length to exceed the limit. 

With that in mind, you may want to move the affected folders closer to the root directory or shorten folder and file names where possible. 

For more information, please refer to: Restrictions and limitations in OneDrive and SharePoint | Microsoft Support

After adjusting the file path length, please try uploading or syncing the files again to see whether the sync completes successfully. 

I hope this provides some additional insight. If you have any updates, please feel free to share them.


Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

3 people found this answer helpful.

0 additional answers

Sort by: Oldest

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.