Python watchdog windows wait till copy finishes

前端 未结 7 1055
南笙
南笙 2021-02-05 22:39

I am using the Python watchdog module on a Windows 2012 server to monitor new files appearing on a shared drive. When watchdog notices the new file it kicks off a database resto

7条回答
  •  逝去的感伤
    2021-02-05 23:27

    I am using a different approach that might not be the most elegant one but is easy to do on any plateform if you have control on the side copying the file.

    Just had 'in-progress' to the name of the file until the copying is complete, and then rename the file. You can then have a while loop waiting for the file with the name without 'in-progress' to exist and you're good.

提交回复
热议问题