I am interesting in monitoring a specific directory to see if it's not empty. I know how to do this using a timer but polling that way isn't very elegant. Does anyone know how to set up an observer I can treat as an event to handle this logic more efficiently?
Thank you in advance!
Best way to observe a directory for changes?
Re: Best way to observe a directory for changes?
A while back there was some code to keep an eye on directory changes. it might still work:
https://www.purebasic.fr/english/viewto ... 82#p542582
It should be easy to update to latest PB
Norm.
https://www.purebasic.fr/english/viewto ... 82#p542582
It should be easy to update to latest PB
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Re: Best way to observe a directory for changes?
Thanks but these are windows-specific.
Re: Best way to observe a directory for changes?
There's a native API that solves this, called FSEvents. I'm not sure exactly how to use it from PB since you need to process incoming events, but maybe this will point you in the right direction or someone else can figure it out.
Re: Best way to observe a directory for changes?
Please stop with the Applescript references. This is a PureBasic forum.