removing a file

8 views
Skip to first unread message

xavi

unread,
Jul 21, 2016, 2:01:45 AM7/21/16
to phonegap
Hello,

I am not able to remove files from persistent neither temporary folders of phonegap (in windows 10 file:///temporary/ or /persistent).

This is the class that I have created for reading/writing/removing:

var app_file = {

fileSystem: null,
init: function() { window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, app_file.gotFS, app_file.fail); }, gotFS: function(fileSystem) { app_file.fileSystem = fileSystem; }, viewLog: function() { directoryEntry = app_file.fileSystem.root; var directoryReader = directoryEntry.createReader(); directoryReader.readEntries(app_file.readDirectory, app_file.fail); }, readDirectory: function(entries){ var sOutput = ""; for(var i=0; i < entries.length; i++) { console.log(entries[i].name); entries[i].remove(function(){ console.log("File removed"); },function(){ console.log("error deleting the file " + error.code); }); } }, fail: function(error) { console.log('app_file error: ' + error.code); } };

every time I execute viewLog method, I get a list of all the files and a console message "File removed", but actually files are never removed, because files are always listed when the method is called.

Any suggestion?


Thanks,
xavi
Reply all
Reply to author
Forward
0 new messages