 <p>I have a working sample on <a href="https://gist.github.com/pkrnjevic/6016356" rel="nofollow">Github</a> that supports inotify directory create/delete events. A small Watch class takes care of mapping wd (watch descriptors) to file/folder names. Here is a snippet showing how to handle inotify CREATE and DELETE events. The full sample is on <a href="https://gist.github.com/pkrnjevic/6016356" rel="nofollow">Github</a>.</p> <pre><code> if ( event-&gt;mask &amp; IN_CREATE ) { current_dir = watch.get(event-&gt;wd); if ( event-&gt;mask &amp; IN_ISDIR ) { new_dir = current_dir + "/" + event-&gt;name; wd = inotify_add_watch( fd, new_dir.c_str(), WATCH_FLAGS ); watch.insert( event-&gt;wd, event-&gt;name, wd ); total_dir_events++; printf( "New directory %s created.\n", new_dir.c_str() ); } else { total_file_events++; printf( "New file %s/%s created.\n", current_dir.c_str(), event-&gt;name ); } } else if ( event-&gt;mask &amp; IN_DELETE ) { if ( event-&gt;mask &amp; IN_ISDIR ) { new_dir = watch.erase( event-&gt;wd, event-&gt;name, &amp;wd ); inotify_rm_watch( fd, wd ); total_dir_events--; printf( "Directory %s deleted.\n", new_dir.c_str() ); } else { current_dir = watch.get(event-&gt;wd); total_file_events--; printf( "File %s/%s deleted.\n", current_dir.c_str(), event-&gt;name ); } } </code></pre>