Skip to main content

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

Project description

FileWatchdog

Documentation Status PyPI Downloads Downloads License

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.7.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filewatchdog-0.1.7-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file filewatchdog-0.1.7.tar.gz.

File metadata

  • Download URL: filewatchdog-0.1.7.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.7 Linux/6.1.91-060191-generic

File hashes

Hashes for filewatchdog-0.1.7.tar.gz
Algorithm Hash digest
SHA256 19ca201789be20e459ec82e97852db70e99fc8b6756690fa0b67769d4df6ca12
MD5 03cacdbb43cfcb4649d247bf03a6ffc0
BLAKE2b-256 bc8321f2ed39a4167831fbe04d831b72e8982bc9a668ca07d92b016052d1f59e

See more details on using hashes here.

File details

Details for the file filewatchdog-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: filewatchdog-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.7 Linux/6.1.91-060191-generic

File hashes

Hashes for filewatchdog-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 53b43be8235aa4771e08333c045cae1f0dfcf181a025654d82d2dfd62801cc90
MD5 a6115b46bc3c3421b1eb2b69ccebd2c8
BLAKE2b-256 453448a3b8e37d8b2f010aef6f4284e6864e880a8fb294eae9ed55663bfd51e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page