Reputation: 11734
On Ubuntu: I want to be able to determine when a file was added to the system or in other words when it was placed/copied into the directory. The time stamp is 'last modified' so when one installs from Apt the timestamp is not the same as when it was actually placed on the system. Thanks
Upvotes: 0
Views: 78
Reputation: 25603
You can use inotify
.
From the manpage: "The inotify API provides a mechanism for monitoring filesystem events. Inotify can be used to monitor individual files, or to monitor directories."
Watching for file or directory change can be done with
int inotify_add_watch(int fd, const char *pathname, uint32_t mask);
where mask can be IN_MODIFY to see all modifications on the file/directory.
Upvotes: 2