#!/bin/sh # # rename files that meet a certain pattern # # cut method takes the name before the first . # and then leaves it to add the extention of your choice # in the last mv command # sed method has greater flexibility. can rename any part of # the name. not sure if i've tested it # for i in photo_?.*html do # two possible ways to do this. cut or sed j=`echo $i | cut -f1 -d '.'` #newname=`echo $i | sed -e 's/shtml/php/'` # echo $j.php #echo $newname # # I will used the cut method mv $i $j.php #mv $i $newname done