Debian-like rename utility - available via MacPorts?
sam.kuper at uclmail.net
Wed Feb 22 19:24:44 PST 2012
On 23 February 2012 01:32, Dan Ports <dports at macports.org> wrote:
> On Wed, Feb 22, 2012 at 11:33:50PM +0000, Sam Kuper wrote:
> > If I'm not mistaken, in Debian Linux (& Ubuntu, etc), there is a
> > "rename" utility, which I think comes from Debian's Perl package. It
> > allows file renaming using regular expressions, as described in Jens
> > Dreger's post here.
> > In any case, it would be much better if MacPorts users could simply
> > get "rename" by running "port install rename" much as Brew users can
> > apparently get it by running "brew install rename".
> Sounds like a useful thing to have. I just added the p5-file-rename
> port, which is a newer version of that script. It installs both a perl
> module and a command-line script `file-rename`.
Thanks for the quick response, Dan!
I just ran "sudo port selfupdate" and then "sudo port install
p5-file-rename", and have now used the "file-rename" script to rename
a few files. Seems to be working fine.
One slight quibble: given that the script seems normally to be invoked
with "rename" rather than "file-rename" (even the synopsis in the man
page I get from entering "man file-rename" seems to expect the script
to be invoked with "rename" rather than "file-rename"!), I think it
might be better if the MacPorts port follows this convention. That
way, users used to using the "rename" script they've obtained via
Debian/Ubuntu/Brew/whatever won't be confused if they switch to
MacPorts. Does this sound fair?
The only snag I can foresee is that although, by default, OS X (at
least, Snow Leopard, which I'm using) doesn't have a "rename" script
installed, it *does*, for some reason, still respond to "man rename".
So some kind of override might be needed to ensure that the correct
man page is shown if a user who has installed p5-file-rename via
MacPorts invokes "man rename". I guess the Brew maintainer for
"rename" must have either stumbled on this stumbling block or found a
way around it, but not being a Brew user, I'm not sure which!
More information about the macports-users