Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Feb 2007 00:36:09 -0500
From:      Peter <pmatulis@sympatico.ca>
To:        freebsd-questions@freebsd.org
Cc:        csevern@pacesetterglobal.com
Subject:   Re: new file notification
Message-ID:  <200702170036.09351.pmatulis@sympatico.ca>
In-Reply-To: <200702170028.45501.pmatulis@sympatico.ca>
References:  <20070216233547.c4t0r75cis8k4oo4@pacesetter1.inetu.net> <200702170028.45501.pmatulis@sympatico.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
Le Samedi 17 F=E9vrier 2007 00:28, Peter a =E9crit=A0:
> Le Vendredi 16 F=E9vrier 2007 23:35, csevern@pacesetterglobal.com a
>
> =E9crit=A0:
> > I have been looking for some kind of freebsd software that will
> > monitor specific directories and then email notify an email address
> > when new files have been added.
> >
> > I have searched the ports tree with no success. If anyone has an
> > idea of a solution and/or a combanation of ports that will achieve
> > this task, i would appreciate it very much.
>
> Why not a simple shell script run with cron?
>
> Hint:
>
> DIR=3D/path/to/target
> OLD_FILES=3D/var/filescheck/number
> NEW_FILES=3D$(ls -al $DIR | grep ^- | wc -l)
>
> if [ $NEW_FILES gt $OLD_FILES ];then
>   mail -s "new files found in $DIR" user@mail.com < /dev/null
> fi
>
> echo $NEW_FILES > $OLD_FILES

Mistake in there.  You need to cat $OLD_FILES....



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702170036.09351.pmatulis>