#!/usr/bin/perl use File::Copy; #get target directory and list the files my $nav = $ARGV[0]; my $topdir = $ARGV[1]; my $dir = $ARGV[2]; my $outdir = $ARGV[3]; opendir $dirhandle, $dir or die "Couldn't open dir $dir: $!"; my @files = readdir $dirhandle; #list of files in $dir closedir $dirhandle; @files = sort(@files); #for each .html file in the target, do: foreach $file (@files) { if ($file =~ /([^\/]+).html$/) { my $infile = "$dir/$file"; my $outfile = "$outdir/$1.php"; print("$file -> $1.php\n"); open $filehandle, "<", $infile or die "Couldn't read file: $!"; open $outfile, ">", $outfile or die "Couldn't write file: $!"; while ($line = <$filehandle>) { $line =~ s/\.html/\.php/g; $line =~ s/\<\/?span[^\>]*?\>//g; $line =~ /