4
1
I'm trying to batch rename some files using the rename
utility (specifically the perl version, i.e. prename
). 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
What is the correct syntax?
What version of rename are you using? None of my research suggests using regexp type transformations. Also, your regexp suggests the name with the apostrophe is what you're converting ~to.~ Is that mandatory? Can you go without the apostrophe? – dafydd – 2013-10-26T04:17:01.287
1
It's the Perl rename utility, which is packaged for Debian/Ubuntu. See: http://stackoverflow.com/questions/14327613/rename-multiple-files-from-command-line for an example. Keeping the apostrophe is the point of the question.
– nomen – 2013-10-26T04:21:20.460