I have a situation wherein , if the user puts a file in the directory I need to do processing on the file , and rest of the time sleep(). How do I detect that there is a change in directory content efficiently ( i.e., without listing ). while(1) { probe_dir_changes(......); sleep(1); }