Aug 122007
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 <- 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.
Incoming search terms:
- linux change file extension (99)
- linux rename extension (93)
- linux rename file extensions (89)
- change file extension linux (59)
- linux rename file extension (59)
- rename file extension linux (58)
- rename extension linux (54)
- linux rename all files with extension (52)
- linux batch rename extension (49)
- linux rename multiple files extension (26)
-
jds
-
James
-
http://kunterbunti.blogspot.com Christian Geisert
-
hron84
-
Zodak
-
Fagner
-
http://www.s3solutions.nl Vincent
-
Will
-
andrew
-
e.m.fields
-
jigna
-
Octavian Neamtu
