'rename' on files with apostrophes
Posted
by
nomen
on Super User
See other posts from Super User
or by nomen
Published on 2013-10-26T03:48:59Z
Indexed on
2013/10/26
3:57 UTC
Read the original article
Hit count: 535
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?
© Super User or respective owner