rename("$dir/$name.$old", "$dir/$name.$new"); [download]
In reply to Re^3: Changing filename extensions by jwkrahn in thread filenames by supernova95