-1

I have a folder of files. I would like for the system to check this folder every X minutes to see if any of the files have changed and, if so, to then run a script that I've written in python.

CGP Grey
  • 101
  • You can write a Python|shell script that calls your script on the folder, then sleeps for X minutes. For persistence, you can use either launchd or cron. – Blacklight Shining Sep 15 '13 at 19:31
  • The problem is that I do not what the script to run every X minutes, only after X minutes and when the files have been modified. – CGP Grey Sep 15 '13 at 19:35
  • 1
    That's what you would be doing? Sleep for X minutes; check if the files have been modified; call the other script if they have; rinse and repeat. – Blacklight Shining Sep 15 '13 at 19:36
  • See DDay's answer on the linked question. – slhck Sep 15 '13 at 20:00

1 Answers1

0

If you're already using Python for the script, take a look at Watchdog.
You can easily install it with PIP, and the link provides a code sample.