Batch Rename of File Extension in Linux

Posted by Sheldon Finlay on January 28, 2009

Sometimes you have a bunch of .html files which you need to rename .php for a project. You could rename them one at a time, but that gets a little old after about 5 files. This little shell script will rename the extension on a whole directory of files:

for f in *.html; do mv $f `basename $f .htm`.php; done;
Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

Comments