Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like that idea of converting metadata to text, so you can do text operations on it that you are already familiar with, and then apply the changes back.

If your problem can be solved by just regexps, there's a "rename" tool installed by Perl I've used for decades. E.g.

    rename -n 's/JPEG$/jpg/' *JPEG
Will apply the substitution for JPEG at end of the filename to just jpg. The -n will run without renaming so you can see what it intends to do.


Beware there are two incompatible rename programs in the wild. :(

What you have installed, and what Debian and its derivates ship is this: https://metacpan.org/pod/distribution/File-Rename/rename.PL

Most(?) other distros ship the one from util-linux: http://man7.org/linux/man-pages/man1/rename.1.html


We had the same idea at the same time. For a command line newbie trying to follow a tutorial, it can certainly be confusing.


A newer tool 'brename' is similar but uses standard inputs and allows for full regex. Like rename it has dry mode for safe renaming.


Note that the rename tool bundled with some distributions is not the Perl version. If someone is looking to install it, it may also be called perl-rename.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: