From 3050e0bbe5fc708ff86af19cc493badf112a05f4 Mon Sep 17 00:00:00 2001 From: jack Date: Fri, 20 Jun 2014 13:46:07 +0200 Subject: [PATCH] add a filter in find, so it won't look for deeper sub-tree (another "rrd-tree" stored in the same root) --- bin/rrd-extractstats.pl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/rrd-extractstats.pl b/bin/rrd-extractstats.pl index a2704ab..b8613ee 100755 --- a/bin/rrd-extractstats.pl +++ b/bin/rrd-extractstats.pl @@ -8,6 +8,7 @@ use strict; use RRDs; use File::Find; +use File::Find::Rule; if ($#ARGV != 2) { die("Usage: $0 outfile\n"); @@ -26,12 +27,7 @@ my @links = values %knownlinks; # walk through all RRD files in the given path and extract stats for all links # from them; write the stats to a text file, sorted by total traffic -my @rrdfiles; -find(sub { - if (-f $_) { - push(@rrdfiles, $File::Find::name); - } -}, $rrdpath); +my @rrdfiles = File::Find::Rule->maxdepth(2)->file->in($rrdpath); my $astraffic = {};