One Drive character limit | PowerShell to find file path character length | File Path Character Limit


One Drive will not sync files with more than 400 charactes in the file path




Use this script and execute to create a list of all files and their number of characters. Address by shortening folder and file names. 

 $pathToScan = "C:\APP1-Data\SharePointData\MW\MW - Documents" # The path to scan and the the lengths for (sub-directories will be scanned as well).
$outputFilePath = "C:\temp\PathLengths.txt" # This must be a file in a directory that exists and does not require admin rights to write to.
$writeToConsoleAsWell = $true # Writing to the console will be much slower.

# Open a new file stream (nice and fast) and write all the paths and their lengths to it.
$outputFileDirectory = Split-Path $outputFilePath -Parent
if (!(Test-Path $outputFileDirectory)) { New-Item $outputFileDirectory -ItemType Directory }
$stream = New-Object System.IO.StreamWriter($outputFilePath, $false)
Get-ChildItem -Path $pathToScan -Recurse -Force | Select-Object -Property FullName, @{Name="FullNameLength";Expression={($_.FullName.Length)}} | Sort-Object -Property FullNameLength -Descending | ForEach-Object {
$filePath = $_.FullName
$length = $_.FullNameLength
$string = "$length : $filePath"

# Write to the Console.
if ($writeToConsoleAsWell) { Write-Host $string }

#Write to the file.

Sync icons (green ticks) are missing from OneDrive for Business synced items

To update the registry, follow these steps:

  1. Open registry editor.
  2. Move to the following folder, and then expand it:
  3. Rename the following registry keys

    Old folder name New folder name
    SkyDrivePro1 (ErrorConflict) <space><space>SkyDrivePro1 (ErrorConflict)
    SkyDrivePro2 (SyncInProgress) <space><space>SkyDrivePro2 (SyncInProgress)
    SkyDrivePro3 (InSync) <space><space>SkyDrivePro3 (InSync)

    On the View menu, click Refresh to verify that the renamed keys now appear at the top of the list.
  4. Exit Registry Editor, and then restart your computer.
  5. Uninstall any other applications that use icon overlays such as DROPBOX


Fix OneDrive for Business with SharePoint Sync Problems

This problem occurs randomly and you can see there are files to be synced but they never do unless you stop and restart the whole folder sync again, but the problem then re-occurs.

Microsoft Engineer advised this is the resolution. 

Stop the folder sync
Terminate groove.exe and mqsvc.exe

Go to AppData/Locla/Microsoft/Office
Delete OfficeFileCache
+ spw

For the 16.0 and 15.0 folders.
Repeat for

Delete "Spw"

Then go to Microsoft Credential Manager and clear all Microsoft Office entries.

Restart the One Drive For Business Sync Client and re-sync to sharepoint

OneDrive for Business Sync Issues

We have found that many sync issues for One Drive for Business can be resolved by Upgrading Office to 2016 and install the full E3/E5 suite and then install the new OneDrive for Business sync client.

Users must be on this licences version of Office 365 for this resolve to work.