SUMMARY: Script looking for new files

From: Dave Landsiedel <Dave_Landsiedel_at_bobcat.com>
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
#17-Jul-03
#Written to send Email of Delivery Report Changes to Publication Personnel

set MAILLIST = "dave_landsiedel@bobcat.com"
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" >
$DELV_DIR/new1
   find $ARIV_DIR -type f -newer $ARIV_DIR/timestamp -name "*.pdf" >
$ARIV_DIR/new2
#####Touch timestamp in each directory prior to the first run of this
script...######
#####Checking for Delivery Reports
        #if (! -r $DELV_DIR/timestamp ) then
        #date > $DELV_DIR/timestamp
        #else
if ( "$DELV_DIR/newfiles" != "" ) then
        mutt  -s "Delivery Reports updated on K:<Drive>" $MAILLIST
< $DELV_DIR/new1
        endif
        rm $DELV_DIR/new1
        date > $DELV_DIR/timestamp.next
        mv $DELV_DIR/timestamp.next $DELV_DIR/timestamp
#####Checking for Arrival Conditions Reports
        #if (! -r $ARIV_DIR/timestamp ) then
        #date > $ARIV_DIR/timestamp
        #else
if ( "$ARIV_DIR/new2" != "" ) then
        mutt  -s "Arrival Condition Reports updated on K:<Drive>" $MAILLIST
< $ARIV_DIR/new2
        endif
        rm $ARIV_DIR/new2
        date > $ARIV_DIR/timestamp.next
        mv $ARIV_DIR/timestamp.next $ARIV_DIR/timestamp


_____________________________

Dave Landsiedel
System Administrator
Email    dave_landsiedel@bobcat.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
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