All pastes #993142 Raw Edit

Anonymous

public text v1 · immutable
#993142 ·published 2008-04-22 12:16 UTC
rendered paste body
rockj@idefix:~$ cat codelines.pl
use strict; use warnings "all";

chdir("@ARGV");
my @files;
my $count = 0;
opendir(DIR,".");
while(my $target = readdir(DIR)){ push(@files,$target); }
while(my $file = shift(@files)){
        if(-d $file && $file=~/^\./){ next; }
        elsif(-d $file){
                print "checking ./$file\n";
                opendir(SUBDIR,$file);
                while(my $subfile = readdir(SUBDIR)){
                        if($subfile=~/^\./ && -d "$file/$subfile"){ next; }
                        else { push(@files,"$file/$subfile"); }
                }
        } else { $count += `cat $file | wc -l`; }
}
print "$count\n";