Not trying to do anything drastic, but I'm renaming my music files from the mp3 title tags. Came across a file this problem:-
$fyl = One Vision [From the Motion Picture Iron Eagle].mp3
$tmp = "tmp.mp3"
$track_title = One vision [From the motion picture Iron Eagle]
rename-item "$mp3path$fyl" -newname "$mp3path$tmp"
rename-item "$mp3path$tmp" -newname "$mp3path$track_title.mp3"
I get the error:- Rename-Item : Cannot rename because item at 'F:\Music\Queen\Live Magic\One Vision [From the Motion Picture Iron Eagle].mp3' does not exist.
The file exists!
I go through a tmp.mp3 in case the files are the same if looked at without case sensitivity.
The code works for files without square brackets, so obviously Powershell is taking them literally.
I did try replacing Rename-Item with Move-Item, but I get similar errors.
Any help is appreciated.