service for file monitoring

R

rohit

hi,
i am designing a desktop search engine using python.
i am having a query , is there a package available that contains
functions for retrieving the files being edited , created,deleted in
the file system.

thanks
 
R

rohit

En Fri, 20 Apr 2007 17:06:51 -0300, rohit <[email protected]>
escribió:


For windows you can use the techniques described here:http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_fo...

hi,
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

regards
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

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:

http://msdn2.microsoft.com/en-us/library/aa364586.aspx

You may have to use ctypes or write an extension module to access that
journal.

Regards,
Martin
 
B

bryan rasmussen

use WMI event monitoring objWMIService.ExecNotificationQuery

http://msdn2.microsoft.com/en-us/library/aa393864.aspx

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

http://tgolden.sc.sabren.com/python/wmi.html


Cheers,
Bryan Rasmussen
 

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
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top