How to get notifed of a new file

Hi Experts,

I want to get a notification when a particular file is created in a particular directory.  I am using Linux.  I don't want to poll.  Is there a way to do it?
ambuliAsked:
Who is Participating?
 
Infinity08Connect With a Mentor Commented:
Have a look at inotify :

        http://en.wikipedia.org/wiki/Inotify

It allows you to do exactly what you need.
0
 
bitsmakebytzesrunConnect With a Mentor Commented:
have you considered doing a file listing/grep in cron?

this will run the check every 10 minutes,  the mail -E flag does not send messages with empty bodies (ie file not found).  you may need to sub /bin, /usr/bin with appropriate local paths or just use ls/mail without path if you have them defined in cron.

crontab -e:

*/10    *       *       *       *       /bin/ls -a | grep "filename" | /usr/bin/mail -Es "1" me@gmail.com
0
All Courses

From novice to tech pro — start learning today.