Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: The situational efficiency of File::Find

by OzzyOsbourne (Chaplain)
on May 09, 2001 at 19:45 UTC ( #79125=note: print w/replies, xml ) Need Help??

in reply to The situational efficiency of File::Find

Update: File::Find even with the prune option seems to take way more time than this piece of code. I say "seems", b/c I canned the file::find version once it ran over the time of this code's benchmark.

Thanks (++) for all the help!

# Finds all of the thingtolookfor.txt across all servers and prints ou +t a list # of those people that do not have them to log.txt use strict; use Benchmark; my $t0 = new Benchmark; my ($server,$usershare); my $out='//mymachine/myshare/log.txt'; my @servers=('XXY','ZZZ','ETC'); open OUT,">$out"; foreach $server (@servers){ my $dir1="//$server/c\$/chompy"; # Check if chompy share is on $C or D$ if (!(-e "$dir1")){#if directory doesn't exist try d$ $dir1="//$server/d\$/chompy"; if (!(-e "$dir1")){ die "Directory not does not exist on $server\n...Exiting S +cript.\n"; } } # Read the user shares opendir(DIR, $dir1) or die "can't opendir $dir1: $!"; #weed out dots and get only dirs my @dirs = grep { !/^\./ && -d "$dir1/$_" } readdir(DIR); closedir DIR; foreach $usershare(@dirs){ my $userdir="$dir1/$usershare"; if (!-e "$userdir/thingtolookfor.txt"){ print OUT "$userdir:\tno\n"; print "$userdir:\tno\n"; } } } close OUT; #benchmarking info my $t1 = new Benchmark; my $td = timediff($t1, $t0); print OUT "The code took:",timestr($td),"\n";


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2023-10-04 23:04 GMT
Find Nodes?
    Voting Booth?

    No recent polls found