I wonder if you can help me, or point me in the right direction. I have been trying for several days to create a lua script to run in the Task Scheduler and:

1. Recognize when a file has been uploaded to a specific directory2. email that file to my email address3. Erase the file

I have written several batch files that accomplish this, but none of them will run from the Task Scheduler Program Execute Window (I have tried both bat and exe files)

The only thing even slightly unusual about the script is that, since the uploaded files are coming from a video camera which is motion-activated, the files are named Lobby-xxx-xxx-xxx where the x's are day-date-time stamps relating to the event. That means that the script can never know in advance what the exact name of the file is that has been uploaded.

Any advice or reference that anyone can provide would be greatly appreciated.

We would like to flush the top Dir out every 60 days for all customers, but leave the bottom Dir untouched. Could this script be modified to achieve such a result?

Presumable we would have to run a loop passing in a different username as a variable to the root clean up dir every-time. It sounds way beyond my knowledge does anyone have anything similar they are willing to share?

function checkfile(nowdir) if c_GetFileDir(nowdir) ~= nil then for isdir,filename in c_GetFileDir(nowdir) do if isdir == false then if filename ~= nil and filename ~= "." and filename ~= ".." then local filepath = nowdir.."/"..filename if c_FileExist(filepath) then if c_GetFileTime(filepath) + timeout < now then table.insert(removefiles, nowdir.."/"..filename) end end end else checkfile(nowdir.."/"..filename) end end endend

function checkfile(nowdir) if c_GetFileDir(nowdir) ~= nil then for isdir,filename in c_GetFileDir(nowdir) do if isdir == false then if filename ~= nil and filename ~= "." and filename ~= ".." then local filepath = nowdir.."/"..filename if c_FileExist(filepath) then if c_GetFileTime(filepath) + timeout < now then table.insert(removefiles, nowdir.."/"..filename) end end end else checkfile(nowdir.."/"..filename) end end endend

function checkfile(nowdir) if c_GetFileDir(nowdir) ~= nil then for isdir,filename in c_GetFileDir(nowdir) do if isdir == false then if filename ~= nil and filename ~= "." and filename ~= ".." then local filepath = nowdir.."/"..filename if c_FileExist(filepath) then if c_GetFileTime(filepath) + timeout < now then table.insert(removefiles, nowdir.."/"..filename) end end end else checkfile(nowdir.."/"..filename) end end endend