hello, I'm wondering the best way to proceed. I'd like to check a directory for files, then wait for a period of time, then check the directory again and compare the first count to the second count. If it changed, sleep again, compare until the reading are equal.
#!/usr/bin/perl -w
use File::Basename;
use POSIX qw(strftime);
my $time = strftime("%r",localtime);
my $dir = "/Users/flieckb/Desktop/testing/2push/";
chdir( $dir ) or warn "$!";
(@dir_files) = glob "*";
my $dircount = @dir_files;
if (@dir_files > 0) {
print "$time there are @dir_files files\n";
sleep (10);
(@dir_files2) = glob "*";
if (@dir_files != @dir_files2) {
$equals = 0;
print "$time there are @dir_files files\n";
print "$time there are @dir_files2 files\n";
} else {
$equals = 1;
print "$time there are @dir_files2 files\n";
}
}