How read name file inside directory ?

Ask, and ye shall receive.
jmuno1967
Posts: 1
Joined: 16:50, 16 May 2016

How read name file inside directory ?

Postby jmuno1967 » 16:58, 16 May 2016

Hi, I use Intel xdk with Cordoba, I can Read file, create directory but is imposible for me read a Directory, I had used several exemples but no work for me, Y used different version of plugins codova file and nothing, give a error Unable to create new directory: " + error.code.

this my code 1

function onSuccess(fileSystem)
{
var directoryEntry = fileSystem.root;

//object to read the contents of the directory
var directoryReader = directoryEntry.createReader();

//now read the contents using the readEntries function.
directoryReader.readEntries(function(entries){
var i;
for (i=0; i<entries.length; i++)
{
console.log(entries[i].name);
}
},function(error){
console.log("Failed to list directory contents. Error code is: " + error.code);
});
}

function onError(evt)
{
console.log("Error occurred during request to file system pointer. Error code is: " + evt.code);
}

this my code 2 this no error but do nothing

function listDirectory() {

window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function (dirEntry) {
var directoryReader = dirEntry.createReader();
directoryReader.readEntries(dirSuccess,dirFail);
});
}

function dirSuccess(entries) {
console.log("INFO: Listing entries");
var i;
for (i=0; i<entries.length; i++) {
console.log(entries[i].name);
}
}

function dirFail(error) {
console.log("Failed to list directory contents: " + error.code);
}

thankyou i can doit work

Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 10 guests