in reply to How much disk space would be freed?

use File::Find::Rule 'rule'; use File::stat; use List::Util 'sum'; print sum( map {stat($_)->size} rule->file->name(qr/log/i) ->mtime("<".(time-30*24*60*60)) ->in("/opt/app/logs") ), "\n";
Not exactly the same because find rounds mtimes. I wish importing stuff didn't take so many characters :-)

Replies are listed 'Best First'.
Re^2: How much disk space would be freed?
by reisinge (Hermit) on Feb 22, 2017 at 12:55 UTC

    Yeah, for me the coolness of my solution is in the fact that it's a one-liner. Thus I can quickly copy/paste it to the shell of any of my servers and see the results. And I forgot to thank Discipulus for recommending the eskimo operator :-).

    Il nostro corpo e il buon cane che guida il cieco. -- L. Sciascia