Newbie - is Windows folder 'watcher' possible?

Lei Chen llchen223 at hotmail.com
Tue Oct 8 17:04:18 EDT 2002


Hi Doug,

Look into these modules and the associated functions.  They should
solve your problem:

win32api module:
  FindFirstChangeNotification
  FindNextChangeNotification
win32event module:
  WaitForSingleObject
glob module:
  glob



Cheers,
Lei

dfinner at Kollsman.com wrote in message news:<mailman.1034084903.15903.python-list at python.org>...
> I have written a simple script that reads a Windows directory and, if files are
> present, logs the file names into a text file and makes a copy of the file(s)
> into another location.  All that works great (and thanks to the Yahoo thread
> 52317, O'Reilly Python Programming on Win32, and the help files for pointers).
> 
> What I'd like to do as an enhancement is to have Python watch a specified
> directory and every time a new file is dumped into the directory, do the log and
> copy operation.   The folder is used by a 'Distiller' program that converts
> various source files into PDFs and I want to monitor use of the directory.  The
> files are in the 'Watch' folder only as long as it takes to generate the PDF
> then deleted.  For this reason, the 'log and copy' program needs to be right on
> top of what's in the folder (i.e. I can't run it once every 5 minutes).
> 
> The question: is it possible?  I like to learn to fish so pointers to the
> correct modules or resources are appreciated more than actual code.
> 
> Watch folder is on a WinNT server.
> I'm running Python 2.2 on Win2000
> 
> My thanks for any help.  I think I'm going to like this language!
> 
> Doug



More information about the Python-list mailing list