I want to know when a new file is created on a specific directory, instead of scanning the directory from time to time.
I understand that there is a way to make the operating system tell my program that a new file was created. How does it work?
As noted, this has similarities with How to be notified of file/directory change in C/C++, ideally using POSIX
Depends on which OS.
On Windows, the base API would be Directory Change Notifications.
Since you mention Linux in the tags, this would be the inotify API.
To add to the OS X answer, as of 10.5, you want the FSEvents API.
Under Linux, check out Inotify.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With