#!/bin/perl use strict; use warnings; use File::Find; use constant EMAIL => glob("~/.mail"); my $IGNORE = "(Spam|trash|Important)"; my $V = (shift || "") eq "-s"; opendir(EDIR, EMAIL) or die $!; while (readdir EDIR) { next if /^\./ or not (-d EMAIL."/$_"); our $count = 0; sub new_dir { my $path = substr $File::Find::name, 1 + length EMAIL; $path =~ s/\/new$//; return if $_ ne "new" or $path =~ /$IGNORE/; #print "ok: $path\n"; my $cnt = 0; opendir(NDIR, "$File::Find::name") or die $!; while (readdir NDIR) { $cnt += 1 unless /^\./; } closedir(NDIR); print "$path: $cnt\n" if not $V and $cnt > 0; $count += $cnt; } find(\&new_dir, EMAIL."/$_"); print "$_: $count\n" if $V and $count > 0; } closedir(EDIR);