Skip to content

Instantly share code, notes, and snippets.



Created Dec 31, 2020
What would you like to do?
counting new files per minute over 3k in a directory
$p = -1;
$intr = 2;
@minute = ();
while(1) {
$c = `find ./scraped -size +3k -ls|wc -l`;
if ($p>=0) {
$t = $c - $p;
push @minute, $t;
if (scalar(@minute)>60/$intr) {
shift @minute;
foreach(@minute) {
print "Per $intr s: $t, per minute: $tm, per 15m: ".($tm*15).", per 30m: ".($tm*30).", per hour: ".($tm*60)." total current: $c\n";
$p = $c;
sleep $intr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment