I currently have this:
Get-ChildItem $somelongpath -Recurse -ErrorVariable MyError -ErrorAction Stop  | where {$_.PSIsContainer} | ForEach-Object{
     if($MyError){
        Write-Host "Don't do it"
     } else {
        Write-Host "Yay!"
     }
}
Say that $somelongpath is a path that exceeds the 260 limit and therefore get-childitem should receive an error and print "Don't do it". But it doesn't... What is happening?