1 |
dpavlin |
1.1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
while( $ARGV[0] ne "" ) { |
4 |
|
|
if( -f $ARGV[0] ) { |
5 |
|
|
$tmpfile = $ARGV[0] . ".bak"; |
6 |
|
|
$ARGV[0] =~ /^(.*?).php3$/; |
7 |
|
|
$outfile = $1 . ".php"; |
8 |
|
|
print "Converting $ARGV[0] -> $outfile\n"; |
9 |
|
|
system "mv -b $ARGV[0] $tmpfile"; |
10 |
|
|
open( INPUT, "< $tmpfile" ) or die("Couldn't open $tmpfile for reading\n"); |
11 |
|
|
open( OUTPUT, "> $outfile" ) or die("Couldn't open $tmpfile for writing\n"); |
12 |
|
|
while( <INPUT> ) { |
13 |
|
|
s/\.php3/\.php/; |
14 |
|
|
print OUTPUT $_; |
15 |
|
|
} |
16 |
|
|
system "rm $tmpfile"; |
17 |
|
|
} |
18 |
|
|
shift; |
19 |
|
|
} |