Hello,
I have written an application which could create (theoretically) an unlimited number of txt files. These all have individual names, based on the date & time when they were created.
Is there a way of browsing the "system.DocumentsDirectory" looking for all txt files (ie "*.txt"), and then returning a list / table of the results?
If not, does anyone have any ideas of how I could manage this?
Thanks
Sadly, no there's not a way to do it (outside of the simulator).
Here's a link to folks that have tried some workarounds that may help. Otherwise, I think you'd have to either create a text file on your own indexing the files you're creating or something to that effect. :(
http://developer.anscamobile.com/forum/2010/09/21/there-function-obtain-file-directory-listing
-Mario
Hello Mario,
Thank you for your reply.
I had a look at the link you gave, and Tom's code (below) works great, but only on the simulator - not on the iPhone.
Tom's code:
1
2
3
| local dir = "'" .. system.pathForFile( x, system.DocumentsDirectory ) .. "'"
local fileDir = "'" .. system.pathForFile( "_files.txt", system.DocumentsDirectory ) .. "'"
os.execute("ls " .. dir .. ">" .. fileDir) |