Directory & File Monitoring

Peter Hansen peter at engcorp.com
Fri Jun 6 13:33:10 EDT 2003


Steve wrote:
> 
> Hi;
> 
> I would like to write a python script for windows 2000 that will log
> who/what touches a particular file in a particular directory.
> 
> Is this possible with python alone or do I need to access some Windows
> api( and which one?)?

Probably not possible with Python alone, and certainly not something
that will be portable (not that you seem to mind).

Can you define what "touch" means?  Do you mean even looking at the
file, or do you mean in the more technical sense of the "touch"
utility, where at least the timestamp is modified?  Or do you just
want to know if the contents are actually changed?  What about if
the file is deleted?

Also, what do you mean by "who" and "what"?  The name of the 
application that is doing the touching, and the userid of the
authenticated user who is running that application?

Maybe even more useful would be for us to understand better why you
want to do this.  It's an unusual thing to want to do at the user
level (i.e. not as part of an OS security/logging feature) and
maybe there's a better solution.

-Peter




More information about the Python-list mailing list