How to rename multiple files in Unix or Linux

Published on June 01, 2010

To rename multiple files at the command prompt, you can use the rename command.

The manpages describes the usage as rename _from_ to _file_

To rename all .csv files to .txt, this is what you do:

rename .csv .txt *.csv

Easy as pie!

To remove all spaces and tildes (~) from *.BAK files:

rename "s/[\s+~]//g" *.BAK

To remove all .pl, .cgi and .sh extensions:

rename "s/\.pl$|\.cgi$|\.sh$//" *

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Published on June 01, 2010