Checking Directory for New File / Recently Added in C using stat()
I am coding in C on RHEL 5.6 and trying to execute a function only when a new file has been added to a known directory.
I am currently using stat(directory, &buffer); and comparing the modification time 'buffer.st_mtime' with a saved value.
This activates on both addition and removal of files but I only care about addition.
Does anyone know of an approach to check only if a file has been added to a directory?