1

My python program takes a statistics file and does some stuff on it. It gets a new stats file everyday, so I need the program to automatically run when a new file is added.

Or it could run at the same time every day.

Thanks

sbakht
  • 11
  • 1
  • 3

1 Answers1

2

There are quite a few possibilities:

Windows:

  • Use Task Scheduler to run the script every day at given intervals.
  • Use the watchdog library to monitor a directory for new files and process it as soon a new file is created. This requires your python script to run endless in a loop (or daemonize it)

Linux:

  • Use crond to run the script at given intervals
  • Use also watchdog or pyinotify to monitor a directory for new files ...
mfussenegger
  • 3,931
  • 23
  • 18