Tuesday, July 6, 2010

Rename mutliple files at once in ubuntu / linux

I would like to rename multiple files at once in my Ubuntu 10.04.
I google around and I found people suggest the following command:
rename .bak .new *.bak

However, this magic does not work in my Ubuntu.
To rename a batch of files with their extension, the following syntax works:

rename 's/\.bak$/\.csv/' *.bak

The above command would rename all files with the extension ".bak" to the new extension ".csv".