in reply to Re: Notification of a new file added to directory
in thread Notification of a new file added to directory

I tried this and it seems to return "true" (1 value) on my directory even though last added file is a week old. Please advise what I am doing wrong?
#!/usr/local/bin/perl use strict; my $mydir = "/mydirectorypath/directory"; my $new_one = 0; opendir(DIR, $mydir) or die("..."); while (my $file = readdir(DIR)) { if (-M $file < .5) { $new_one = 1; last; } } closedir(DIR); print "$new_one\n";

Replies are listed 'Best First'.
Re: Re: Re: NOtification of a new file added to directory
by gjb (Vicar) on Jan 03, 2003 at 15:43 UTC

    I modified the original node. Sorry for the confusion, it was silly on my part, -gjb-

      Thanks for your patience and time! It now works and I learned alot from this.