I’ve created a PowerShell function that is able to delete a long path (>260) using the mentioned robocopy technique:

function Remove-PathToLongDirectory { Param( [string]$directory )

# create a temporary (empty) directory
$parent = \[System.IO.Path\]::GetTempPath()
\[string\] $name = \[System.Guid\]::NewGuid()
$tempDirectory = New-Item -ItemType Directory -Path (Join-Path $parent $name)

robocopy /MIR $tempDirectory.FullName $directory | out-null
Remove-Item $directory -Force | out-null
Remove-Item $tempDirectory -Force | out-null }

 

Usage example:

Remove-PathToLongDirectory c:\yourlongPath