I cant find a find an answer that is clear to me. I am changing a bunch of image file names in a directory, when I rename them they all get renamed to image (1).png image (2).png for as many images as I have then I run this in power shell.
Dir | Rename-Item –NewName { $_.name –replace " ","_" }
This finds the space and renames it to image_(1).png image_(2).png nice and easy, but It becomes a headache trying to replace the parentheses. I am trying to get rid of them to look like this image_1.png image_2.png but it's gotten really frustrating finding an answer lol.
I wish I could just write.
Dir | Rename-Item –NewName { $_.name –replace "\(*\)","*" }
or
Dir | Rename-Item –NewName { $_.name –replace "\([1-10]\)","[1-10]" }
or
Dir | Rename-Item –NewName { $_.name –replace "\(\W\)","\W" }
I tried them all and you would think that syntax is valid, but nope :( So I am hoping for a little nudge in the right direction.