RE: [PHP] Side Comment (was: Newbie Question: Converting PHP3 fil es to PHP4?)
| From: | Christopher William Wesley | Date: | Tue, 04 Sep 2001 06:17:17 +0000 |
| Subject: | RE: [PHP] Side Comment (was: Newbie Question: Converting PHP3 fil es to PHP4?) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65845@lists.php.net to get a copy of this message | ||
On Tue, 4 Sep 2001, Jason Murray wrote:
> But then, the right tools make the job easy regardless of
> platform.
For sure! I don't bother with all that clicking ... now you [Unix folk]
don't have to either :)
#!/bin/sh
for PHP3FILE in
find . -type f -name "*.php3" -print
do
PHP4FILE=echo ${PHP3FILE} | sed 's/\.php3/\.php/g'
sed 's/\.php3/\.php/g' ${PHP3FILE} > ${PHP4FILE}
done
#END OF SCRIPT
That recursively finds all files starting in whatever directory you like,
and creates the newly-named files with all the references corrected as
desired (with a small addition, the old files can be archived or removed).
I just had some fun with that script and a copy of an old doc root ... 17
directories, deepest directory was at 3 levels, and 216 .php3 files (from
1998 :) ... took a few seconds to make all the modifications.
~Chris /"\
\ / Pine Ribbon Campaign
Microsoft Security Specialist X Against Outlook
The moron in Oxymoron. / \ http://www.thebackrow.net