Get the Perl rename utility instead of the built-in rename

前端 未结 4 562
离开以前
离开以前 2020-11-27 05:28

Many sites (including various SO articles) talk about using \"rename\" using Perl expressions to rename files.

This would be perfect, but apparently this is not the

4条回答
  •  清歌不尽
    2020-11-27 05:58

    I can only speak for Debian. The two programs are called

    • /usr/bin/rename.ul from the util-linux package (hence the .ul suffix)
    • /usr/bin/prename from the perl package

    The actual rename command works via the /etc/alternatives mechanism, whereby

    • /usr/bin/rename is a symlink to /etc/alternatives/rename
    • /etc/alternatives/rename is a symlink to /usr/bin/prename

    The same problem has been bugging me on Cygwin, which is a Red Hat product, so should be more similar to Fedora. I'll have a look on my company laptop on Monday. And I remember the Perl-rename having worked there sometimes. Probably before I installed util-linux.

    If you install the Perl-rename to /usr/local/bin it will have precedence over rename from util-linux. Same goes for the manpage when installed to /usr/local/share/man/man1/.

    I've just created a separate Perl-rename package on Github: https://github.com/subogero/rename

提交回复
热议问题