Remove a temporary file of a certain age

Is there anyway of pulling back from the temporary directory the date the file was written?  I could do with clearing out the files based on date, but it is not clear how I can access that information.

I havent done that myself yet but a quick read would assume it possible

http://keplerproject.github.io/luafilesystem/manual.html#reference

Awesome!  Thanks a lot.

Corona supports LFS. See: https://docs.coronalabs.com/api/library/lfs/index.html

Rob

Thanks guys - my code to remove certain files from the temporary store which are older than 24 hours… Guess I should turn it into a function…

 local doc\_path = system.pathForFile( "", system.TemporaryDirectory ) local work\_path = "" local fileDetails = {} for file in lfs.dir(doc\_path) do work\_path = system.pathForFile( file, system.TemporaryDirectory ) fileDetails = lfs.attributes(work\_path) if (file ~= "settings.txt") then if string.find(file, "resimage") ~= nil then if tonumber(os.date("%M",os.time()-fileDetails.modification)) \> 1440 then os.remove(system.pathForFile( file, system.TemporaryDirectory)) end else os.remove(system.pathForFile( file, system.TemporaryDirectory )) end end end

I havent done that myself yet but a quick read would assume it possible

http://keplerproject.github.io/luafilesystem/manual.html#reference

Awesome!  Thanks a lot.

Corona supports LFS. See: https://docs.coronalabs.com/api/library/lfs/index.html

Rob

Thanks guys - my code to remove certain files from the temporary store which are older than 24 hours… Guess I should turn it into a function…

 local doc\_path = system.pathForFile( "", system.TemporaryDirectory ) local work\_path = "" local fileDetails = {} for file in lfs.dir(doc\_path) do work\_path = system.pathForFile( file, system.TemporaryDirectory ) fileDetails = lfs.attributes(work\_path) if (file ~= "settings.txt") then if string.find(file, "resimage") ~= nil then if tonumber(os.date("%M",os.time()-fileDetails.modification)) \> 1440 then os.remove(system.pathForFile( file, system.TemporaryDirectory)) end else os.remove(system.pathForFile( file, system.TemporaryDirectory )) end end end