Jose Torres wrote: > > Hi, Hello,
> I have a directory with several subdirectories, each full of several dozen > Word files. For each subdirectory, I need to run the checksum app against > all of that directory's files and output a file into that directory with the > checksum results. How can I do this? I'm very unfamilar with running > command-line commands from within an Perl script. I know to change > directories, you can do something like this: > > $changeDir = "cd ".$startingDir; > system($changeDir); > > but what about retrieving the list of subdirectories from the starting > directory? How can I do this? > Thanks for your help. This should give you some ideas on how to do it use warnings; use strict; use File::Find; my %files; find( sub { # put all .doc files in the hash push @{$files{$File::Find::dir}}, $File::Find::name if /\.doc$/i # get the directory name from the command line }, @ARGV ); for my $dir ( keys %files ) { open CHK, "> $dir/checksum" or die "Cannot open $dir/checksum: $!"; for my $file ( @$dir ) { # this is assuming 'checksum' prints to standard output chomp( my $checksum = qx[checksum $file] ); print CHK "$file $checksum\n"; } } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]