These articles have answered my question None of them really works for me I think it's because the string i'm trying to replace has a Tell me the best way to handle this?
I have an image file that was replaced by u00a9 during a site migration They're like this
and I want to change it to something like this.
These examples all start with "lu00a9ucky but here are many images with different names. I'm just looking at the u00a9 part of the string i'm replacing with safe
somethingelse for filenames in the current directory (not recursive) you can use the GNU rename utility.
rename 's/#/somethingelse/' *
- must be escaped with a
For your case, you would want to use
rename 's/#U00a9/safe/g' *
Note that if you only want to operate on a certain selection of files, e.g., only
*.jpg , adjust the final input to match that selection.
rename 's/#U00a9/safe/g' *.jpg
To perform a test before actually changing filenames, use the
demo/> rename -n 's/#U00a9/safe/g' *.jpg
For OS X, GNU rename can be installed using homebrew :
brew install rename .