Runs Python functions once a certain file is created or modified.
Project description
FileWatchdog
Runs Python functions once a certain file is created or modified.
Installation
pip install filewatchdog
Usage
import filewatchdog as watcher
import time
def job():
print("I'm working...")
# detecting changes to one single file
watcher.once().file('C:/Temp/1.txt').modified.do(job)
watcher.once().file('C:/Temp/1.txt').exists.do(job)
# detecting file changes in a directory recursively
watcher.once().folder('C:/Temp').modified.do(job)
# watching multiple files
files = ['C:/Temp/1.txt', 'C:/Temp/2.txt', 'C:/Temp/3.txt']
watcher.once().one_of(files).modified.do(job)
watcher.once().all_of(files).exist.do(job)
while True:
watcher.run_pending()
time.sleep(1)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
filewatchdog-0.1.5.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for filewatchdog-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a1a24007309acf0b705e97c02f95ccfaa6e7ff8c10fbe0d0a8dae91328af5e7 |
|
MD5 | 8492852027009c311bb13d365802d12e |
|
BLAKE2b-256 | abd7fa915562e44402672c5c29d120bda3622fae3ed82ffac45172e222b76d15 |