Subscribe to
NSLog(); Header Image


Pardon me for thinking so, but $19.95 for A Better Finder Rename (or even $9.95 for the upgrade and $24.95 for the "forever" license) is a bit more than I'm willing to pay for a tool I need to use, at most, about once a month.

But isn't there some sort of CLI tool that can do this? Obviously I can pipe some commands through some awkward sed chain or something, but isn't there some "renamer" tool that can do things like find and replace " " with "_" in filenames and lower-case any upper-case letters? Simple things like that?

And if there isn't one already, would someone be interested in working on one with me?

10 Responses to "CLI ABFR"

  1. Have you tried Automator's "Rename Finder Items" action?

  2. Brooke, I have. It's not a CLI app, of course, but it's a good substitute for ABFR. I'm still hoping to find (or build) a CLI version.

  3. I use Renamer4Mac. It's a GUI app, but it's free and has (among other options) regex support.

  4. I typically use the Finder scripts that are included with Mac OS X, accessible via the Scripts menu, but that's not a command-line solution either.

  5. A lot of linux distributions include a perl script called "rename" which lets you specify perl code for modifying names. (For example, to rename *.foo to end in .bar, you could run "rename 's/foo$/bar/' *.foo")

    I found a copy of the source here

    run "pod2man rename > rename.1" to generate the man page (then stick it wherever you keep man pages for stuff you've installed) .. if you just want to view it, you can use "pod2man rename | nroff -man | less" (or just "pod2text rename" if you don't care about underlines, bold, etc.)

  6. File Buddy is pretty nice for this type thing (although it's much much more than a renamer.)

  7. The perl util is nice. You can also use some simple shell scripting (no need for sed/awk):

    For instance, say you want to UPPER->lower files:

    $ mkdir test

    $ cd test

    $ for i in 1 2 3 4; do touch ABCD$i; done

    $ ls


    $ for i in `ls`; do j=`echo $i | tr [A-Z] [a-z]`; mv $i $j; done

    $ ls

    abcd1 abcd2 abcd3 abcd4

    Of course you'll be creating 2 new processes for every file...

  8. find . -type f -name \*.whatever -print0 | xargs -0 rename -s/FROM_PATTERN/TO_PATTERN/g

    works under most shells.

  9. To go with all of the other posts that don't offer a command line solution, I recommend R-Name as an excellent replacement for ABFR. With the AppleScript I have, you can even make a selection and press Command-Shift-R to start the process.

  10. Try R-Name3. It's free.