Folder Update Script

Hi,

I would like to write a script for send out a notification once a folder has been updated or receive a file.

I have folder with name SOURCE,this folder receiving source files from third party vendor in 24hrs.now i want a notification mail once the folder updated with some thing or once source files has been arived.

To start with try this....

#!/bin/bash -x

SOURCE=/your/source/directory
B_SOURCE=/your/archive/directory

while true
do
        find $SOURCE -type f -name "*" -mmin +1 -print > /tmp/testfile.txt

        if [ -f /tmp/testfile.txt ]; then
        echo "File Found" | mail -s "File Found" koti_rama@example.com
        for x in `cat /tmp/testfile.txt`
        do
            mv $x $B_SOURCE
        done
        fi
        sleep 60
        rm -rf /tmp/testfile.txt
done

Try this in a cron:

[ ! -z $(find SOURCE -type f -mtime -1 -print) ] && echo 'Files updated!' | mail -s "Folder Updates" user@domain