My Opera is closing 1st of March

M.I.T = Multimedia IT dept.

Subscribe to RSS feed

monitor files in a directory using perl

,

#!/usr/bin/perl
while (true) {
opendir (DIR, "/work/perl/tmp") or die "Cannot open /my/dir: $!\n";
my @Dircontent = readdir DIR;
close DIR;
my $items_in_dir = @Dircontent;
if ($items_in_dir > 2) { # > 2 because of "." and ".."
print @Dircontent;
# do_something_now(); # takes file(s) and moves them
}
#else {sleep 100;}
}

REFERENCE: how to permanently monitor a directory
http://www.perlmonks.org/?node_id=283849
February 2014
M T W T F S S
January 2014March 2014
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28