http://paperlined.org/apps/linux/my_standard_tools/watchmod.pl
#!/usr/bin/perl
# Watches all files under the current directory, and displays their name every time they're touched.
use strict;
use warnings;
my $last_mod = time();
my $last_file_printed = "";
while (1) {
open PIN, "find -type f 2>/dev/null |" or die;
my $next_last_mod = $last_mod;
while (<PIN>) {
s/[\n\r]+$//s; # chomp
my $mod = (stat $_)[9]
or next;
if ($mod > $last_mod) {
$next_last_mod = $mod if ($mod > $next_last_mod);
printf "%s%-20s %-8d %s",
$last_file_printed ?
(($_ eq $last_file_printed) ? "\e[2k\e[0G" : "\n")
: "",
scalar(localtime($mod)),
-s $_,
$_;
$| = 1;
$last_file_printed = $_;
}
}
$last_mod = $next_last_mod;
}
Generated by GNU enscript 1.6.4.