Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to get notifed of a new file

Posted on 2011-09-14
2
Medium Priority
?
349 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 1000 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 1000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

610 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