#!/usr/local/bin/perl # # recurs.pl # # This script executes recursively on subdirs the command you supply as a parameter # # Run "program -h" to see the run options # # Last modified: Apr 10 1997 # Author: Bekman Stas <[EMAIL PROTECTED]>; # <[EMAIL PROTECTED]>;
$|=1; # Set here the pattern extensions of your image files # Usage (@ARGV == 1 ) || die ("Usage: recurs.pl [-h] \n\t-h this help\n\n"); $command=$ARGV[0]; #$command=~s/(.*)/'$1'/; &recursive(); # Subroutine "recursive" goes recursively down at the dir tree and # and runs the $ARGV[0] for you. After comming to the end it's coming back up # at the tree. sub recursive { system($command); #print "$command\n"; #die; foreach $dir (<*>;) { if (-d $dir) { # print "$dir\n"; chdir $dir; &recursive(); chdir ".."; } } } On 12/2/05, The Ghost <[EMAIL PROTECTED]> wrote: > > I want to know how many new line chars there are in all files in a > directory (and it's subdirectories). What's the best way? > > Thanks! > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > >