Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

Re: Comparing files with same name in different directories

by Rudif (Hermit)
on Aug 01, 2001 at 21:00 UTC ( #101441=note: print w/replies, xml ) Need Help??

in reply to Comparing files with same name in different directories

Tuna, you said

What I'm trying to do is:
1. recurse through 5 different directory structures. Each directory structure contains identically named files.

'Recurse' seems to imply that your directory structures might have subdirectories that you wish to recurse into.

If this is the case, or even if not, a solution based on File::Find might fit your needs. For example:

#!perl -w use strict; use File::Find; my $prefixDir = "$ENV{HOME}/sa/current"; my @clusterDirs= ("$prefixDir/cluster1", "$prefixDir/cluster2", "$pref +ixDir/cluster3", "$prefixDir/cluster4", "$prefixDir/cluster5"); for my $dir ( @clusterDirs ) { print "$dir\n"; find( sub { return unless -T; printf "file: $_: %d\n", -s; # file name only # printf "file: $File::Find::name: %d\n", -s; # full path }, $dir); }

Cheers, Rudif

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://101441]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2023-12-10 21:17 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.