I have hundreds of files with paths longer than 260 characters that I wish to rename. Using Powershell, I can find the long names using cmd /c dir /s /b |? {$_.length -gt 260}
, but the actual cmdlets don't support long filenames: Get-Item would return
"cannot find path [long path] because it does not exist"
I read that a module called NTFSSecurity can work with long paths, but so far I only know that it can list the files using a cmdlet called Get-ChildItem2. I still don't know a way to actually rename the files this way.
Outside of Powershell, I found a tool named TLPD that can list the files, but that's all.
So far I've only been able to deal with it by manually renaming the parent folders so that the path becomes short enough to be accessed (I may be able to emulate this process using Powershell — but I'd appreciate an easier way)
Edit: to clarify, I'd like to keep the files instead of deleting them as much as possible.
Best Answer
I wrote a script that worked. Thanks to jftuga for the subst suggestion.