Is there a way to count all directories within a folder with file system api without being stuck in an infinite loop!?
Can't figure out why or where the leak is but I eventually had to quit my app after it got to 50K - it never looked like reaching an end point. I am on OS X so is it counting all the hidden directories and files such as DS Store?
//path: my folder
app.workspace.getDirectory(path, {}, function(directory){
var reader = directory.createReader();
if(directory){
reader.readEntries(function(entries){
for(var i = 0; entries.length; i++) {
if(entries.isDirectory){
console.log('Directory: ', entries[i]);
}
else {
//don't need to know anything else...
}
}
});
}
}, error);