Silverfox wrote:
> 
> Hi all, I'm looking for the best way to search/test multiple directories
> for a specific file and exec a command depending on which directory is
> missing the file. any advice?
> 
> ex:
> (I'm searching for "filename" in the following dir)
> /dir1/file/search
> /dir2/file/search
> /dir3/file/search/filename
> 
> command:
> we need to know which directory the file was found in and exec command.


my $file = 'filename';
my @dirs = qw(/dir1/file/search /dir2/file/search /dir2/file/search);

for my $dir ( @dirs ) {
    unless ( -e "$dir/$file" ) {
        print "$dir/$file does NOT exist!\n";
        }
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to