phonegap删除子文件夹中的文件

时间:2014-10-03 09:27:00

标签: javascript android cordova

我想删除phonegap android应用程序中的文件。 文件存在于子文件夹中。 我在互联网上找到了一个示例代码。但我看不到。 Phonegap docs 对我来说是不够的。有人可以回答我如何删除子文件夹中的文件。

function deleteFilelists(tx,results)
{


        var fileName = "cdvfile://localhost/persistent//flower.jpg"
        removefile(fileName);


    function removefile(fileName){

    fileSystem.root.getFile(fileName, {create: false, exclusive: false}, gotRemoveFileEntry, fail);
    }

    function gotRemoveFileEntry(fileEntry){
        fileEntry.remove(success, fail);
    }

    function success(entry) {
        alert("Removal succeeded");
    }

    function fail(error) {
        alert("Error removing file: " + error.code);
    }
}

0 个答案:

没有答案