On linux, you can use the F_NOTIFY fcntl. See the fcntl(2) manpage.
In reply to Re: detect directory change by ambrus in thread detect directory change by leocharre