in reply to How do I recursively process files through directories
sub recurse { my($path) = @_; print( "working in: $path\n" ); # append a trailing / if it's not there $path .= '/' if($path !~ /\/$/); # loop through the files contained in the directory for my $eachFile (glob($path . '*')) { # if the file is a directory if( -d $eachFile) { # pass the directory to the routine ( recursion ) recurse($eachFile); } else { handleFile( $eachFile ); } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How do I recursively process files through directories
by porqui (Acolyte) on Sep 01, 2004 at 21:59 UTC |