'rename' on files with apostrophes
- by nomen
I'm trying to batch rename some files using the 'rename' utility. Unfortunately, the file names contain apostrophes, and it's messing things up. I'm not sure how to proceed.
Here's what I've tried:
rename -n '/.*(\d\d).jpg/Foo's Excellent Photo - $1.jpg/' # fails due to end of string
rename -n '/.*(\d\d).jpg/Foo\'s Excellent Photo - $1.jpg/' # fails due to end of string
rename -n "/.*(\d\d).jpg/Foo's Excellent Photo - $1.jpg/" # fails due to shell expansion
Can anybody help?