What is Watchdog in Python
Watchdog is a python module that can be used to monitor file system changes. As the name suggests this module observes the given directory and can notify if a file is created or changed.
Step 1: Import some Stuff
import os import time from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler
Step 2: Create the event handler
if __name__ == "__main__": # patterns = "*" # the file patterns we want to handle patterns = "*.csv" # choose only csv files ignore_patterns = "" ignore_directories = True case_sensitive = True # Create the event handler my_event_handler = PatternMatchingEventHandler(patterns, ignore_patterns, ignore_directories, case_sensitive)