Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically run python script, when file is added to folder?

How can I automatically run a python script, whenever a Word-File is added to a specific folder? This python script would need to work with the Word-File afterwards. My operating system is Windows.

Thanks for your help in advance.

like image 211
O. Schultz Avatar asked Mar 29 '18 13:03

O. Schultz


People also ask

Does Python script run automatically?

Step 1: Open Task Scheduler Application on your Windows Machine. Step 2: Click on 'Create Basic Task…. ' in the Actions Tab. And give a suitable Name and Description of your task that you want to Automate and click on Next.

How do you trigger a file in Python?

To run Python scripts with the python command, you need to open a command-line and type in the word python , or python3 if you have both versions, followed by the path to your script, just like this: $ python3 hello.py Hello World!


1 Answers

There are several ways to do this and also a special Python package for this

Watchdog Python script for Windows file system

https://pypi.python.org/pypi/watchdog

https://blog.philippklaus.de/2011/08/use-the-python-module-watchdog-to-monitor-directories-for-changes

like image 134
Joe Avatar answered Nov 09 '22 11:11

Joe