Metadata-Version: 2.1
Name: filewatchdog
Version: 0.1.5
Summary: Runs Python functions once a certain file is created or modified.
License: MIT
Author: BeginnerSC
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: schedule (>=1.2.1,<2.0.0)
Description-Content-Type: text/markdown

# FileWatchdog

[![Documentation Status](https://readthedocs.org/projects/filewatchdog/badge/?version=latest)](https://filewatchdog.readthedocs.io/en/latest/?badge=latest)
[![PyPI](http://img.shields.io/pypi/v/filewatchdog.svg)](https://pypi.python.org/pypi/filewatchdog/)
[![Downloads](https://static.pepy.tech/badge/filewatchdog)](https://pepy.tech/project/filewatchdog)
[![Downloads](https://static.pepy.tech/badge/filewatchdog/month)](https://pepy.tech/project/filewatchdog)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/beginnerSC/filewatchdog/blob/master/LICENSE)


Runs Python functions once a certain file is created or modified. 

## Installation

```sh
pip install filewatchdog
```

## Usage

```py
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)
```

