how do you watch for an incoming file

Suu Quan quan at hplabsb.HP.COM
Wed Nov 29 08:10:51 AEST 1989


	How do I write a C-program or shell script that will watch for
the presence of a new file in a certain directory.

Scenario : I expect a file to be sent to me -name possibly unknown- to a
directory (callit /application/inputfile/). Since I do not know when it
will arrive (ftp, rcp ... does not matter), I want to be notified of its
presence as soon as possible but not burn any cpu in the mean time.

I know how to write a shell script will a loop and a sleep a la :
cd /application/inputfile/
while (1)
do
  sleep($some)
  if [ $(/bin/ls) ]    # assume ksh
  then
       echo there is something in here
  else
	;
  fi
done.

	But I would prefer a C-program or a script using a blocking command
	Any help is appreciated
-- 
Suu Quan  (TELNET/415) 857-3594			quan at hpcmfs.corp.HP.COM
HEWLETT-PACKARD, Corp Manuf Factory Systems	quan at hpcmfs
Palo Alto, CA 94304				suu quan /HP0080/04



More information about the Comp.unix.questions mailing list