Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: detecting file changes

by graff (Chancellor)
on Oct 14, 2006 at 15:39 UTC ( [id://578292]=note: print w/replies, xml ) Need Help??


in reply to detecting file changes

You don't mention what OS you're using, and I don't actually know if this is an OS-dependent issue, but I do know that on any unix-like system, the file size reported by "-s" will reflect the recent growth of a file while it is actively being written to by some other process:
my $path = "dir/file_to_watch"; my $prev_size = -s $path; while (1) { sleep 5; my $size_now = -s $path; if ( $size_now > $prev_size ){ print "file grew as of ".scalar localtime().$/; $prev_size = $size_now; } }

Replies are listed 'Best First'.
Re^2: detecting file changes
by Anonymous Monk on Oct 14, 2006 at 18:58 UTC
    I should have mentioned that this is for Win32

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-19 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found