Sample Header Ad - 728x90

Unix 11i v2 Script to detect new files within directory

0 votes
2 answers
1879 views
I was hoping someone can point me in the right direction. I would like to create a script to check for new files (files with today's date) within a directory and then print the results to a text file. Could I use cron or bash? edit: Updated original thread. I tried the following on my Linux Mint VM and I got it to work. The only problem is: 1) when i create a new file (using "sudo vi newtextfile.txt" and then ":w") i receive the notification email *4 times*. 2) am i triggering multiple IN_CREATE events by creating a new file using the method i mentioned above? /xyz/jon >>> total 12 786436 drwxr-xr-x 2 root root 4096 Jul 13 20:43 . 786434 drwxr-xr-x 4 root root 4096 Jul 13 19:45 .. 786441 -rwxr-xr-x 1 root root 48 Jul 13 20:32 mylogger.sh 786437 -rw-r--r-- 1 root root 0 Jul 13 20:22 mylogtoday.txt "incron.table-jonincron" >>> /xyz/client IN_CREATE /xyz/jon/mylogger.sh /xyz/jon/mylogger.sh >>> sudo mail -s "testing script" emailaddress@domain.com
Asked by jes516 (863 rep)
Jul 13, 2014, 09:01 PM
Last activity: Jul 28, 2025, 10:01 PM