Thursday, August 11, 2011

How to change the extension to several files at a time

If you work every day with line commands and pipes, and process several files at a time, perhaps you need to rename them at once, mainly to change file extension, I think.

mmv command is very useful to do this and it is included in all well-known linux distros.

For example, to change file extension from .tmp to .txt to all files inside current directory, you can type:

$ echo "*.tmp #1.txt" | mmv

But mmv has much other capabilities (see man page for details). A simple -c option in command line arguments allows you to preserve original files, that is, to copy (instead of move) serveral files at a time.

0 comments: