From 41d639f738b466732a65276537121f34b808657f Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Thu, 6 Apr 2017 15:02:31 +0200 Subject: [PATCH] Recurse into all paths passed to files.pl The script used to ignore all but the first CLI argument. Now, we loop over ARGV and recurse into all paths. This makes it possible to check the size of multiple folders in the root filesystem in one go, excluding others that may live e.g. on another partition: files.pl /root /var /boot /etc /usr --- files.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/files.pl b/files.pl index b792d7c1..26a6ace8 100755 --- a/files.pl +++ b/files.pl @@ -21,14 +21,16 @@ sub usage { print STDERR "Intended to be piped to flamegraph.pl. Full example:\n"; print STDERR " $0 /Users | flamegraph.pl " . "--hash --countname=bytes > files.svg\n"; + print STDERR " $0 /usr /home /root /etc | flamegraph.pl " . + "--hash --countname=bytes > files.svg\n"; exit 1; } usage() if @ARGV == 0 or $ARGV[0] eq "--help" or $ARGV[0] eq "-h"; -my $dir = $ARGV[0]; - -find(\&wanted, $dir); +foreach my $dir (@ARGV) { + find(\&wanted, $dir); +} sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = stat($_);