Renaming files in OSX with brew rename

By | October 25, 2016

There is a neat tool to rename files very quickly. Install it with brew via

>> brew rename

I had to remove the dot from this file name: 2016-10-24 19.12.15.jpg because the system that I was using was poorly designed and expected a file extension after the first period.

I ran

>> rename -nvs '.' '' *

n = dry run. The new file name will be printed in the console for visual inspection only.
v = verbose.
s = search for the first occurrence.

The above command would only remove the first period. I needed to remove the other one also.

>> rename -nS '.' '' *

would remove all occurrences. This also didn’t work because it removed the “.” in the “.jpg” as well!

In the end, I had to run the first command twice.

Category: OSX

Leave a Reply

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