Iterating through a list file

Apologies for the newbie question. I have done this in java and C#, but I’ve after spending an hour consulting forums, I’m still confused.

I am attempting to check if a certain file exists in the documents directory.

Currently, I’m listing all of the items in the directory into a text file using the code

 local dir = "'" .. system.pathForFile( x, system.DocumentsDirectory ) .. "'"  
 local fileDir = "'" .. system.pathForFile( "\_files.txt", system.DocumentsDirectory ) .. "'"  
 os.execute("ls " .. dir .. "\>" .. fileDir)  

now I need to iterate through the file and check to see if a file exists. Any help would be great! [import]uid: 34103 topic_id: 22052 reply_id: 322052[/import]

If this is on an iOS device, this code might work in the simulator but will not work on a device. You can get the directory, but the sandbox restricts much of your access.

On an Android, I haven’t tried so cannot comment, One Ansca Staff had claimed and promised a solution for this (about 3-6 months ago) within the hour but there is nothing…

Here’s an article that outlines some of the constraints and my attempts at trying something similar.

http://howto.oz-apps.com/2012/01/enumerate-files-in-directory-not.html
[import]uid: 3826 topic_id: 22052 reply_id: 87653[/import]