#!/usr/bin/perl &SRDir(".", $ARGV[0], $ARGV[1]); 1; sub SRDir { local ($Path, $Old, $New) = @_; opendir(flDir, "$Path"); @filelist = readdir(flDir); closedir(flDir); foreach $FN ( @filelist ) { if ( $FN eq '.' || $FN eq '..' ) { next; } print "$Path/$FN\n"; if ( -d "$Path/$FN" ) { &SRDir("$Path/$FN",$Old,$New); } elsif ( -e "$Path/$FN" ) { open(fl, "$Path/$FN"); read(fl, $Content, (-s "$Path/$FN") ); close(fl); $Content =~ s/$Old/$New/g; print "Changing $Path/$FN\n"; open(fl, ">$Path/$FN"); print fl $Content; close(fl); } } }