Find long folder and file paths with PowerShell
Often during server migrations we come across an issue when using Windows Sync Centre to sync up staff devices in that the path limit is 260 chars, using this simple one line we are able to find the paths that are too long for Sync Centre to sync up and rename them.
Once the folders have been renamed you can use takeown and icacls to set the permissions see here.
Open an Administrative PowerShell window, CD to the directory in question and run the following command.
Get-ChildItem -Recurse -Force -ErrorAction SilentlyContinue | Where-Object {$_.FullName.Length -gt 250}
One thought on “Find long folder and file paths with PowerShell”