Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Test files not being processed

by bofh_of_oz (Hermit)
on Jul 20, 2005 at 15:32 UTC ( #476532=note: print w/replies, xml ) Need Help??

in reply to Test files not being processed

Firstly, do you have a timestamp in the name of those files? If so, you can use glob and regex the filenames...

If not, you can use this:

use strict; use warnings; use File::Glob; my $path = ""; my ($oldest, $fname) = (time, ''); my $modtime; chdir $path; foreach (glob("*")) { if (-f) { $modtime = (stat($_))[10]; ($oldest = $modtime and $fname = $_) if ($oldest > $modtime); } } print "$fname\t$oldest\n"; (abs(time() - $oldest) < 300) ? print "File recent enough\n" : print "Reporting an error\n";
This will go through files in a directory ($path), find the oldest file, check if it was modified (created or overwritten) within last 300 seconds... the rest insert accordingly.

An idea is not responsible for the people who believe in it...

Replies are listed 'Best First'.
Re^2: Test files not being processed
by BadHabit (Initiate) on Jul 20, 2005 at 16:28 UTC
    Hurrah for bofh_of_oz! I had been re-working the script to regex the timestamp but I think your code is much more succinct and reusable.

    I not only now love PERL (only been playing for three weeks), I also love this forum.

    Thanks to ARUNBEAR for the READMORE tags, I shall use them in future.
Re^2: Test files not being processed
by Anonymous Monk on Sep 28, 2005 at 17:37 UTC
    I think the above will help me to see if new files are being written to my server, but I do not understand how $oldest is the oldest file.
    I need to know that the newest file was modified in the last ten minutes, so could someone explain the logic so I can hack this code myself?
    Thanks Monks . . .

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://476532]
[Corion]: Yay. FF now has u2f built-in (behind an about:config setting), so using an USB token to sign in actually works :)
[Corion]: So, it's not all bad with the new FF :)
[holli]: 2factor is a bit too much for me. i just use passwords like jhbn8789q27312laks dmaw98^
[moritz]: isn't there also some about:config setting to enable the old plugin API?
[Discipulus]: indeed, only the logo is nicer
[Corion]: moritz: Hmm, I doubt so, as I think they moved away from XUL and other UI stuff, which was used by most plugins I used
[Corion]: holli: I'm trying it out with Github and so far I don't dislike it. It's basically like an extra key I press to log in, which is an OK flow for Github
[Corion]: I haven't tried out recovery in case of a broken USB key though (even though I have three such U2F tokens lying around here)
[oiskuu]: randomly banging on the keyboard yields pretty poor entropy. much better to just base64 some /dev/random
moritz has a pass entry with recovery codes

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-11-20 20:23 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (293 votes). Check out past polls.