You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

rename or prename is Perl a tool which can rename multiple files using regular expression.
For example: remove underline mark (_) from file name

rename -v 's/_//' *
-v, --verbose
-n, --no-act

Test before action

Usually you should use -n and -v option to test your expression. After you make sure that it works as you expected, remove the -n option to do the real job.

Another example: to rename ??.mp3 files to 0??.mp3

rename -v 's/(\d{2}).mp3/0$1.mp3/' ??.mp3
  • No labels