Win32::ChangeNotify + $module = detect download ?

P

perl coder

I'm using the Win32::ChangeNotify to monitor a folder, in order to find
which files are being modified. I setup a handler with the LAST_WRITE
flag, and it works great, and I can find the exact filename that changed
by checking the timestamps of all the files in that folder.

One thing bugs me though: I can't detect whether or not a file is
changing because it's been closed or if it's still open and actively
being written to (frex, somebody downloading a file with a web browser
or something). So I'm wondering if there's a relatively easy way to
find this out. In Unix you can at least check with 'lsof' and
'netstat -nap' and get a good idea of what's going on, but I'm new to
the win32 world, and I'm still not sure of what's possible and what
isn't. Perhaps is there a module that will help with this? If not, I
noticed that Perl at least gives a way to make straight win32 system
calls (with Win32::API), so perhaps there's a system call I can use
then?

I'd rather avoid having to check a file at regular intervals to see if
it's changing. It might work, but doesn't sound like a very robust
solution. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top