Skip to main content

Supported Platforms

  • Linux 2.6 (inotify)

  • Windows (ReadDirectoryChangesW with I/O completion ports)

  • Any other platform (polling)

Installation

$ python setup.py install

Introduction

The fsmonitor module provides live filesystem monitoring. It can be used to monitor for events such as file creation, deletion, modification and so on:

from fsmonitor import FSMonitor

The FSMonitor class manages filesystem watches and is used to receive events. Call the add_dir_watch() method to add a directory watch to the monitor:

m = FSMonitor()
watch = m.add_dir_watch("/dir/to/watch")

Once a watch has been added, you can call read_events() to read a list of filesystem events. This is a blocking call and in some cases it might return an empty list, so it needs to be re-called repeatedly to get more events:

while True:
    for evt in m.read_events():
        print evt.action_name, evt.name

The FSMonitorThread class can be used to receive events asynchronously with a callback. The callback will be called from another thread so it is responsible for thread-safety. If a callback is not specified, the thread will collect events in a list which can be read by calling read_events().

More Details

See the example code in the examples directory.

Contact Details

Please send any comments or questions to: luke@iogopro.co.uk

Please report bugs on the github issue tracker.

– Luke McCarthy

Release files for fsmonitor 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fsmonitor 0.1
File Size Uploaded
fsmonitor-0.1.tar.gz 6.3 kB Details

Release files / fsmonitor-0.1.tar.gz

Download URL fsmonitor-0.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
397fc47e339ce8aaa6f7a27fe376d4e614579038ff9c61bf28c6733fb1d0c5cd
BLAKE2b-256 checksum
How to use checksums
311562befc5ae5117fd4e6b7dfb367e992226080d6d206d27dd2212c03300b2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page