"faulkner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > you want a directory watching daemon. it isn't hard at all to build > from scratch. > first, determine which directories should be watched. > then, os.walk each directory, building a mapping from filename to mtime > [modified time; os.path.getmtime]. > next is your main event loop. this while loop consists of os.walk-ing > each directory again, comparing the current mtime to the corresponding > entry in the mapping. if they differ, or if a filename isn't in the > mapping, something happened, at which point you can logick out whether > a file was moved, deleted, changed, or created. > > so many folks have looked for this that i'll just write a generic one > and put it in the cheeseshop. look for "dirmon" in about a week. > > Ahem... (sorry for premature usenet-post-ication...)
While I am a big fan of "brute force", there are OS services (at least on Windows) for doing just this function, with asynchronous callbacks when files are created, deleted, etc. Here is a link that does a much better comparison of several options than I could (including your brute force version): http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html Good luck! -- Paul -- http://mail.python.org/mailman/listinfo/python-list