pythonfilecross-platformfilesystemsmonitoring

Monitoring contents of files/directories?


I'm looking for a cross-platform file monitoring python package? I know it is possible to monitor files on windows using pywin32, and there are packages working on Linux/Unix but does anyone know about a cross-platform one?


Solution

  • For Unix/Linux based systems, you should use File Alteration Monitor Python bindings to libfam.

    For Windows based systems, you should tie into the Win32 API FindFirstChangeNotification and related functions.

    As for a cross platform way, I don't know about a good cross platform way. I think it would be best to build a module yourself that works on either OS that uses one of the 2 above methods after detecting what OS it is.