monitor a folder for file creation, how?

Mike Meyer mwm at
Thu Jul 28 22:31:41 EDT 2005

fanbanlo <henryho at> writes:

> How do I monitor a folder for new file(s) creation?
> How to use thread to do a wait until a new file is 'detected'?

There's not a clean portable way to do this.

The portable way is to poll the update time of the folder at regular
intervals, and act when it changes. I did that for a Maildir mail
monitoring tool once, but can't seem to find the source now. Sorry.

The clean way depends on your platform. Most modern system have a
mechanism to get the kernel to notify you when a file/directory is
updated. But they are all different. Since you say "folder", I assume
you're on Windows - and I can't help you with this one.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list