Click to See Complete Forum and Search --> : Get notified of file creation and directory modification


fairdox
September 26th, 2005, 05:35 PM
Hi,
I have a very simple server that receives transactions by file (I don’t use any type of messaging, signalling, or inter process communication)

Now is there a better way to wait for a new file being created in my input directory, than simply polling the directory every half a second?

What I’m looking for is a callback function or even a blocking function that returns when a new file has been created in a directory.
Or perhaps a hook in file system that notifies my process that a new file is available.

The directory is shared, so the file can be created by another PC on the LAN.

Thank you.

kirants
September 26th, 2005, 05:46 PM
I have not done this personally, but just to give you pointers.. please search the forum for keyword SHChangeNotify. You are sure to hit some related discussions.

fairdox
September 26th, 2005, 09:36 PM
Thank you very much.

SHChangeNotifyRegister is the one that seems promising. The process gets notified of various shell events.

I've also found FindFirstChangeNotification in the forum I'm going to implement.

kirants
September 27th, 2005, 12:29 AM
You are welcome .. good luck :wave: