A simple unix/linux script to HELP convert php file underscores and alter local site link backs via rpl command – helps improve seo. This assumes the rpl command is installed, and all php files are at the same level – no recursive sub directory changes. Warning – could also change external links if they happened to have the same underscore original file name.. Also assumes no white spaces in the original php file names.

1
2
3
4
5
6
7
#!/bin/sh
for FILE in `ls -1 *_*.php`
do
echo $FILE changes to `echo $FILE | sed s/_/-/g`
rpl $FILE `echo $FILE | sed s/_/-/g` *
mv $FILE `echo $FILE | sed s/_/-/g`
done