Bulk Rename Files on Mac OSX

With the need to rename lots of files in bulk I have come to love a terminal application called ‘rename’. On Mac you can install it using Brew by running

brew install rename

Then if you want to rename all the files in a directory so they have a hyphen instead of an underscore you just do

rename -n ‘s/_/-/’ *

The -n flag says to run it as a test and don’t actually change the files. Once I confirm that it is working, I run it again without the test flag like so

rename -v ‘s/_/-/’ *

The v flag outputs what files were changed. You can find a few more examples at http://tips.webdesign10.com/how-to-bulk-rename-files-in-linux-in-the-terminal

Published by


I am a Geek! I hope you enjoyed this recent post.