sending mail when I get a new file-possible?

This is how I would do it. This script stores the “date/time stamp” into the schedule’s comment field (to survive reboots, which a global variable won’t do). It gets the date and time values from the comment and then checks all “FTP…log” files for any that are newer, and sends email if any are found. Make sure to change the first line to be the schedule you want to store the variable in. I adapted this from another script found here: http://forum.mikrotik.com/t/compare-dates/53609/1
:local scheduleName “checkFTPlogs”

:local months {“jan”;“feb”;“mar”;“apr”;“may”;“jun”;“jul”;“aug”;“sep”;“oct”;“nov”;“dec”}
:local toggle false
/file

:foreach i in=[find name~“^FTP.+log”] do={

:local current [/system scheduler get [find name=“$scheduleName”] comment]
:local cyr [:pick $current 7 11]
:local cmo [:find $months [:pick $current 0 3]]
:if ($cmo < 10) do={ :set cmo (“0” . $cmo); }
:local cday [:pick $current 4 6]
:local chr [:pick $current 12 14]
:local cmin [:pick $current 15 17]
:local csec [:pick $current 18 20]
:local currentDate ($cyr.$cmo.$cday.$chr.$cmin.$csec)

:local new [get $i creation-time]
:local nyr [:pick $new 7 11]
:local nmo [:find $months [:pick $new 0 3]]
:if ($nmo < 10) do={ :set nmo (“0” . $nmo); }
:local nday [:pick $new 4 6]
:local nhr [:pick $new 12 14]
:local nmin [:pick $new 15 17]
:local nsec [:pick $new 18 20]
:local newDate ($nyr.$nmo.$nday.$nhr.$nmin.$nsec)

:if ($newDate > $currentDate) do={
:set toggle true
/system scheduler set [find name=“$scheduleName”] comment=“$new”
}
}

:if ($toggle = true) do={
:log warning message=“NEED To SEND MAIL!!!”
/system script run mail
}