FlashAir Execute on Write Event Properties

403 Views Asked by At

Using the dropbox sample code I am working on a Lua script that will run each time a new file is added (a photo in this case) to a specific folder. I see examples to iterate through a folders files to upload them each in turn. What I need is the properties that are passed to the file that will execute each time a new file is written. I'm hoping it will be passed the filename for the last file created so I can use that to upload the file directly to Dropbox or FTP site.

1

There are 1 best solutions below

0
On

HI someone in japan solved your doubt as the following.

last_filepath = "" max_mod = 0 fpath = "/DCIM/100__TSB"
for filename in lfs.dir(fpath) do
filepath = fpath .. "/" .. filename
mod = lfs.attributes( filepath, "modification" )
if mod > max_mod then max_mod = mod last_filepath = filepath
end end

basically it set a directory to search for the latest file with newest modification date/time.

details r here http://dotnsf.blog.jp/archives/1040120555.html