service for file monitoring

bryan rasmussen rasmussen.bryan at
Sun Apr 22 12:42:22 CEST 2007

use WMI event monitoring objWMIService.ExecNotificationQuery

, then pass the event and the file starting the event to your
application via the command line, what I tend to do (so I keep one
monitor running that starts applications at event occurrence)

drawback but also a strength, the application cannot know for sure
that the event has actually happened - this is a possible strength
because then you can have other applications that redefine the
occasion of the event on a file just by starting your application for
handling that event and passing it a file asserted as having been the
object receiving the event (probably too loosely coupled for lots of
people or scenarios though, if this can be a security problem for your
application have to protect against it etc. )

if you absolutely need monitoring and application tightly coupled then
use Python and WMI to do it, using the same method.

Bryan Rasmussen

On 4/21/07, "Martin v. Löwis" <martin at> wrote:
> > well i tried reading that but that way i'll have to make the program
> > monitor each and every directory.
> > when a file is created or deleted or filename modified , a call must
> > be made to the os kernel .
> > isn't there any way i can utilize that with any api or package
> > functions so that i can monitor the whole filesystem but at lesser
> > expense of cpu n memory
> On Windows W2k+, you can use the USN journal:
> You may have to use ctypes or write an extension module to access that
> journal.
> Regards,
> Martin
> --

More information about the Python-list mailing list