The title says it all and yes I know there are many questions similar, but the closest I could find was removing " and not '. What I've tried so far is:

find -name "*'*" -type f | rename 's/\'//g'

or rename 's/[']//g' and some other variations. I find all the files, but when I'm piping it to rename, I'm just getting >for prompt and have to Ctrl+C to return. I've recently changed a lot of files with this, and it has worked like a charm on any special character, except the single quotes.


You can use double quotes:

rename -n "s/'//g"

remove -n after testing to rename the files for real

Use -exec though...

find -name "*'*" -type f -exec rename -n "s/'//g" '{}' \;

If the list is not too long, make it faster...

find -name "*'*" -type f -exec rename -n "s/'//g" '{}' +
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.