1

I want to ask you, how I can track file events (e.g. create, update, delete, etc.) on unix using c?

2 Answers2

2

Use inotify.

From the man page:

The inotify API provides a mechanism for monitoring file system events. Inotify can be used to monitor individual files, or to monitor directories. When a directory is monitored, inotify will return events for the directory itself, and for files inside the directory.

Essentially you create an inotify instance with inotify_init which returns an fd, then add a number of watches with inotify_add_watch. You can then select on the fd and will get notified of any changes relating to the watches you have made.

abligh
  • 24,573
  • 4
  • 47
  • 84
-1

Unix native package do not provide anything to maintain file versions. you can use SVN unix tool to maintain versions.

user1011046
  • 204
  • 1
  • 5
  • 16