Removing certain text in multiple filenames in OS X

I had a large number of ebooks that looked like the following:

Walter%20Isaacson%20-%20Einstein_His%20Life%20And%20Universe.mobi

And because I’m lazy, I looked for an automated way to clean all of them up.  This is how:

1. Back up all your files in another directory
2. Launch terminal
3. Go to the directory you’d like to perform the changes
4. Type: for i in *.mobi; do mv "$i" "`echo $i | sed ‘s/%20/ /g’`"; done
5. That’s it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.