jesuashok has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl my $parent_dir = "/panther/home/efxprod/support"; process_dir($parent_dir); sub process_dir { my $dir = shift; print "Processing $dir\n"; opendir(SCR , $dir) or die "Can't open $dir: $!"; while( defined ($file = readdir SCR) ) { next if ($file =~ /\.$/ ); next if ($file =~ /\.txt$/ ); if ( $file =~ /\.sh$/ ) { print "not a regullar file: $file\n"; } elsif ( $file =~ /\.pl$/) { print "perl $file\n"; } elsif ( -d "$dir/$file" ) { print "directory : $file\n"; process_dir("$dir/$file/"); #next; #} elsif ( $file } else { print "Else :$file\n" if ( -B "$dir/$file"); } print "file -> $file\n"; } return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Require input reading files recursively in perl
by CountOrlok (Friar) on Apr 17, 2013 at 13:22 UTC | |
by jesuashok (Curate) on Apr 17, 2013 at 13:28 UTC | |
|
Re: Require input reading files recursively in perl
by kcott (Archbishop) on Apr 17, 2013 at 13:19 UTC | |
by educated_foo (Vicar) on Apr 17, 2013 at 14:06 UTC | |
|
Re: Require input reading files recursively in perl
by hdb (Monsignor) on Apr 17, 2013 at 13:12 UTC | |
|
Re: Require input reading files recursively in perl
by choroba (Cardinal) on Apr 17, 2013 at 13:09 UTC | |
by jesuashok (Curate) on Apr 17, 2013 at 13:24 UTC |