Solved

How to get notifed of a new file

Posted on 2011-09-14
2
337 Views
Last Modified: 2012-05-12
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?
0
Comment
Question by:ambuli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 250 total points
ID: 36537414
Have a look at inotify :

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

It allows you to do exactly what you need.
0
 
LVL 1

Assisted Solution

by:bitsmakebytzesrun
bitsmakebytzesrun earned 250 total points
ID: 36537451
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
smtp c source code 7 129
Acrinis True image 2 118
C++ Code Issue 4 45
boost::uuid crashes 17 59
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question