| |
| sub walk { |
| my $dir = shift; |
| opendir(DIR, $dir) or die $!; |
| my @files = readdir DIR; |
| closedir DIR; |
| for $fdir ( @files ) { |
| next if( $fdir =~ /^\./ ); |
| if( -d "$dir/$fdir" ) { |
| walk( "$dir/$fdir" ); |
| } else { |
| apply( "$dir/$fdir" ); |
| } |
| } |
| } |
| |
| sub apply { |
| my $f = shift; |
| return if( $f =~ /.avi$/ ); |
| return if( $f =~ /.pdf$/ ); |
| return if( $f =~ /temp.*\.pl$/ ); |
| open FILE, "$f" or die $!; |
| $whole = join "", <FILE>; |
| close FILE; |
| if( $whole =~ /org\/processes\/master-timeline.php/ ) { |
| print "$f\n"; |
| $whole =~ s/<a\s+href="(([\.\/]*)|(http:\/\/(www.)?eclipse.org))\/org\/processes\/master-timeline.php"(.*?)>/<a href="\/projects\/timeline\/"$5>/is; |
| open FILE, ">$f" or die $!; |
| print FILE $whole; |
| close FILE; |
| } |
| } |
| |
| walk( "." ); |