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').exist.do(job)
# detecting file changes in a directory recursively
watcher.once().folder('C:/Temp').modified.do(job)
watcher.once().folder('C:/Temp').exist.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.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for filewatchdog-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d63ee176d82f9880d0bd9e464947a084c321bf39446815e9e25fc10757ec981f |
|
MD5 | d8494303dc88ec0d1715ab34691af16d |
|
BLAKE2b-256 | 7c5369a29f3bf610e0d053edbea1a6ff3f4f0e6b80f381b5984efd93f04d60d3 |