views:

42

answers:

1

so lets say i have a pre existing directories /source/version/1 , /source/version/2, /source/version/3 I want to monitor if there is a NEW directory created /source/version/4, and send an email if such directory is indeed created.

+1  A: 

The Linux kernel subsystem that allows an application to receive notifications of file system changes, such as directory creation, is called inotify. There is a Ruby interface to inotify, but there doesn't seem to be much documentation available for it.

kfsmd is a daemon for monitoring file system changes (using inotify). It has a client that produces output to the console whenever a change occurs. You could pipe this output into your Ruby script and parse it.

mikej