Let us say that you want to rename all of your “.php3” files to “.php” files. How you do this with minimal effort? Answer lies in for loop.
for old in *.php3; do cp $old `basename $old .php3`.php; done
Thats all there is to it. Let us say you need to rename index.php3 to index.php. The way above snippet works is that it loops through current directory and finds all the files with extension “.php3” and processes ’em one by one. In our index.php3 file example, it finds index.php3 file, does a cp index.php3 `basename index.php3 .php3`.php <- basename returns “index” so you add .php to it and now you are left with index.php. Of course you can do mv command if you want to just move the file to new name. I would suggest doing cp first to make sure things work the way you want ’em to.