How to rename multiple files in Unix or Linux
To rename multiple files at the command prompt, you can use the
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$//" *
Created on 01 June 2010
Affiliate Disclosure: Some of the links to products on this blog are affiliate links. It simply means, at no additional cost to you, we’ll earn a commission if you click through and buy any product.