How do I delete a file?

Hi,

I store persistent game data in a file but in some cases I would like to delete the file completely. I’ve tried:

file = io.open( filePath, "w+" )  
io.close( file )  

and this clears the contents, creating an empty file, but the file is still there.

Is there a way to completely delete the file?

Thanks
EC [import]uid: 29384 topic_id: 6307 reply_id: 306307[/import]

Try this:

[lua]local results, reason = os.remove( “apple.txt” )

if results then
print( “file removed” )
else
print( “file does not exist”, reason )
end
–> file does not exist apple.txt: No such file or directory[/lua]

More info at:
http://developer.anscamobile.com/reference/index/osremove [import]uid: 8045 topic_id: 6307 reply_id: 21779[/import]

Tried it, and it does exactly what I wanted! Thanks for the quick response luna. [import]uid: 29384 topic_id: 6307 reply_id: 21781[/import]

Good to hear it’s working. I was trying to do the same thing a few days ago. [import]uid: 8045 topic_id: 6307 reply_id: 21787[/import]