Currency : $

Python App

Application for mobile, desktop ..


from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

class MyHandler(FileSystemEventHandler):
def on_any_event(self, event):
if event.is_directory:
return # Ignore directory events

if event.event_type == 'created':
print(f"File created: {event.src_path}")
elif event.event_type == 'modified' and not event.is_directory:
print(f"File modified: {event.src_path}")
elif event.event_type == 'deleted':
print(f"File deleted: {event.src_path}")

if __name__ == "__main__":
path = "/Users/apple/Desktop/Python-Pro/CAM/"
event_handler = MyHandler()
observer = Observer()
observer.schedule(event_handler, path, recursive=True)
observer.start()

try:
print(f"Monitoring {path} for changes. Press Ctrl+C to stop.")
observer.join()
except KeyboardInterrupt:
observer.stop()
observer.join()

Start saving on your next adventure today!

Subscribe to Anna and Layla Travel for exclusive discounts on excursions, activities, and airport transport. Unlock special offers tailored to your interests.