Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Reset the time after a readdir

by Anonymous Monk
on Oct 21, 2014 at 23:44 UTC ( [id://1104618]=note: print w/replies, xml ) Need Help??


in reply to Re: Reset the time after a readdir
in thread Reset the time after a readdir

So maybe

#!/usr/local/bin/perl -- ## theTimeDifferCopier.pl ## 2014-10-21-16:50:47 ## ## ## ## ## ## perltidy -olq -csc -csci=3 -cscl="sub : BEGIN END " -otr -opr -ce +-nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while " -otr + -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); sub Main { my $basetime = $^T; my $lasttime = $basetime; while( 1 ) { my @files = WantedFiles( $dir, $filterPattern ); for my $file ( @files ) { my $mtime = ( stat $file )[9]; my $diffSeconds = $mtime - $lasttime; if( $diffSeconds < 30 ) { print "## $file is so new its $diffSeconds old\n"; } } sleep 1; $lasttime = time; } } ## end sub Main sub WantedFiles { my( $dir, $filter ) = @_; ...; } ## end sub WantedFiles

Or

#!/usr/local/bin/perl -- ## theTimeDifferCopier.pl ## 2014-10-21-16:50:47 ## ## ## ## ## ## perltidy -olq -csc -csci=3 -cscl="sub : BEGIN END " -otr -opr -ce +-nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while " -otr + -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; Main( @ARGV ); exit( 0 ); sub Main { my $basetime = $^T; my $lasttime = $basetime; while( 1 ) { my @files = path( $dir )->children( qr/$filterPattern/ ); for my $file ( @files ) { my $mtime = $file->stat->mtime; my $diffSeconds = $mtime - $lasttime; if( $diffSeconds < 30 ) { print "## $file is so new its $diffSeconds old\n"; } } sleep 1; $lasttime = time; } } ## end sub Main

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1104618]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found