Re: converting .php files to .dhtml
From: Alan Cox (alan_at_lxorguk.ukuu.org.uk)
Date: 07/19/05
- Previous message: Dan Track: "Weird high load on server"
- In reply to: Ankush Grover: "Re: converting .php files to .dhtml"
- Next in thread: Ankush Grover: "Re: converting .php files to .dhtml"
- Reply: Ankush Grover: "Re: converting .php files to .dhtml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: For users of Fedora Core releases <fedora-list@redhat.com>, Ankush Grover <ankush174@gmail.com> Date: Tue, 19 Jul 2005 14:36:20 +0100
On Maw, 2005-07-19 at 18:16 +0530, Ankush Grover wrote:
> I wanted to test this out but out application is big and there are
> lots of subdirectories and many php files (500 files).So it is
> difficult to change the extension of every php file manually.
Its actually one of the harder problems in shell script to do this
The tools you need are "basename" "find" and "mv"
Basename will trim the ending off a name
eg
%basename fred.php .php
fred
mv you hopefully know
and find generates a list of files matching some rules and optionally
applies an action to them. So we can do
find . -name "*.php" -print
and get a list of the PHP files
So
for i in $(find . -name "*.php" -print)
do
echo $i
done
will also print all the names using shell script
Next we can do
for i in $(find . -name "*.php" -print)
do
echo $(basename $i .php)
done
and we should see all the names without php
and finally (after making a backup!)
for i in $(find . -name "*.php" -print)
do
mv $i $(basename $i .php)".dhtml"
done
You might need more quotes if you use filenames containing spaces or *
but I've left that out to avoid confusion in the explanation
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
- Previous message: Dan Track: "Weird high load on server"
- In reply to: Ankush Grover: "Re: converting .php files to .dhtml"
- Next in thread: Ankush Grover: "Re: converting .php files to .dhtml"
- Reply: Ankush Grover: "Re: converting .php files to .dhtml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|