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.
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.