Tuesday, March 15, 2011

make php content to static html

SkyHi @ Tuesday, March 15, 2011
cat convertphp2htmlextension.sh
<?php
for i in `ls -l tammm.com/`
#do
#       mv $i.php $i.html
#done

find . -type f -name *.php -exec rename -v 's/\.php/\.html/' {} \;

cat convertphp2htmlextension.sh
<?php
#!/bin/bash

txt2text() {
        # ls -1 only list file line by line
        for i in `ls -1`
        do
                mv $i `echo $i |sed 's/.*\.php$/.html/'`
        done
}
txt2text


replace all php to html in html files
<?php
perl -pi -e 's/php/html/g' ./*.html
##the -i flag tells it do in-place replacement