Hi
Hoping someone can help, I've been running a script to delete files/folders and it's been running great, however recently some of the folder names have become very long and the script cannot delete these and errors with:
"Remove-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260characters, and the directory name must be less than 248 characters."
I've googled this error and it seems that this is a limitation of PS and .Net?Is there any way around this?
Here is the code for the script:$filelocation = "e:\oldbackups" gci -path $filelocation -r | where-object {$_.PsIsContainer -eq "True"} | ?{$_.creationtime -lt (get-date).adddays(-30)} | %{del $_.fullname -r -force}
If you are getting a "Path Too Long" error, Long Path Tool can fix you to Move, Copy, Rename etc. Must try