Trackback URI | Comments are closed.
Rename multiple files to another extension in Linux
August 12th, 2007
View original post
Let us say that you want to rename all of your “.php5″ files to “.php” files. You can use for loop.
for old in *.php5; do cp $old `basename $old .php5`.php; done
Thats all there is to it. Let us say you need to rename index.php5 to index.php. The way above snippet works is that it loops through current directory and finds all the files with extension “.php5″ and processes ‘one by one. In our index.php5 file example, it finds index.php5 file, does a cp index.php5 `basename index.php5 .php5`.php
Tag: Rename multiple files to another extension in LinuxRename multiple files to another extension in Linux
Related posts
View source postFiled under Debian |