Watching a directory for changes

Net Llama! netllama
Mon May 17 11:39:22 PDT 2004


How many files will ordinarily be in this directory?  If you're using a 
shell script for this, then odds are you're going to need to be parsing 
the output from ls, which means you're going to be dependent on the 
number of files listed.  At some point the number of files will take at 
least 1second, if not more just for 'ls' to output. Something to think 
about unless we're talking about a small number of files.

On 10/24/2002 06:56 PM, Joel Hammer wrote:
> I want to have a background job watching a directory for new files
> arriving, and then responding when they arrive.
> The response time has to be very quick (impatient humans), maybe on the order
> of a 1/2 second or less.
> I could have a bash script watching the directory, but the sleep command
> works in intervals of 1 second. Not fast enuf.
> Any ideas appreciated,

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                       	       netllama at linux-sxs.org
Linux Step-by-step & TyGeMo: 		    http://netllama.ipfox.com

   7:05pm  up 12 days,  7:23,  2 users,  load average: 0.15, 0.09, 0.09



More information about the Linux-users mailing list