I'm using inotifywait to watch for new files. I would like to ignore new directories though. I can't seem to get anything to work.
Here is what I'm using:
#!/bin/sh
MONITORDIR1="/hdd_1/path/to/dir"
MONITORDIR2="/hdd_1/path/to/dir"
#MONITORDIR3="/hdd_1/path/to/dir"
#MONITORDIR4="/hdd_1/path/to/dir"
monitor() {
inotifywait -m -r -e create --exclude '/\..+' --format "%f" "$1" | while read NEWFILE
do
echo "This is an automated email." | mail -s "${NEWFILE} has been added to Daemon!" "user@domain.com"
done
}
monitor "$MONITORDIR1" &
monitor "$MONITORDIR2" &
#monitor "$MONITORDIR3" &
#monitor "$MONITORDIR4" &