Many Linux distributions ship some variant or another of the Perl rename script, sometimes as prename
, sometimes as rename
. Any variant will do, but not the Linux rename
utility that isn't written in Perl (run it with no argument and see if the help text mentions perl anywhere). This script runs Perl code on file names, typically a regex replacement.
prename -n 's/;(03[2-9]|0[4-9][0-9]|1[01][0-9]|12[0-6])/chr($1)/eg' *
I made a regular expression that matches three-digit numbers that are the character code of a printable ASCII character. You may need to adjust it depending on exactly what can follow a semicolon. The *
at the end says to rename all files in the current directory, it's just a normal shell wildcard. It's ok to include files that don't contain anything to rename: prename
will just skip them.
The -n
option says to show what would be done, but don't actually rename any file. Review the output. If you're happy with it, run the command again without -n
to actually rename the files.