SUMMARY: Script looking for new files

From: Dave Landsiedel <>
Date: Mon Jul 21 2003 - 12:43:00 EDT
Thanks to all of you that replied, there is too many names to list.
I appreciate the quick response from everyone that did indeed reply
with a possible solution.

Original Post:
> Just wondering if someone out there has written a script in either shell
or perl
> to search a specific folder/directory for new files?  I have a need to
search a
> folder and if there is a new file email a notification to a vendor.  The
> bad thing is the file name isn't specific though the extension is and I
am not sure how
> often a new file would be place out in this folder.
> If the file had a specific name it would be no problem.

Here is what I came up with and am currently using.

#/bin/csh -x
#Written to send Email of Delivery Report Changes to Publication Personnel

set MAILLIST = ""
set DELV_DIR = "/usr8/data/public/publications/delivery_reports"
set ARIV_DIR = "/usr8/data/public/publications/arrival_condition_report"
   find $DELV_DIR -type f -newer $DELV_DIR/timestamp -name "*.pdf" >
   find $ARIV_DIR -type f -newer $ARIV_DIR/timestamp -name "*.pdf" >
#####Touch timestamp in each directory prior to the first run of this
#####Checking for Delivery Reports
        #if (! -r $DELV_DIR/timestamp ) then
        #date > $DELV_DIR/timestamp
if ( "$DELV_DIR/newfiles" != "" ) then
        mutt  -s "Delivery Reports updated on K:<Drive>" $MAILLIST
< $DELV_DIR/new1
        rm $DELV_DIR/new1
        date > $DELV_DIR/
        mv $DELV_DIR/ $DELV_DIR/timestamp
#####Checking for Arrival Conditions Reports
        #if (! -r $ARIV_DIR/timestamp ) then
        #date > $ARIV_DIR/timestamp
if ( "$ARIV_DIR/new2" != "" ) then
        mutt  -s "Arrival Condition Reports updated on K:<Drive>" $MAILLIST
< $ARIV_DIR/new2
        rm $ARIV_DIR/new2
        date > $ARIV_DIR/
        mv $ARIV_DIR/ $ARIV_DIR/timestamp


Dave Landsiedel
System Administrator
sunmanagers mailing list
Received on Mon Jul 21 12:42:55 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:16 EST