Cordova list all files from application directory (WWW)
You can use this function to get all available files in www/audio/ folder
function listDir(path){
window.resolveLocalFileSystemURL(path,
function (fileSystem) {
var reader = fileSystem.createReader();
reader.readEntries(
function (entries) {
console.log(entries);
},
function (err) {
console.log(err);
}
);
}, function (err) {
console.log(err);
}
);
}
//example: list of www/audio/ folder in cordova/ionic app.
listDir(cordova.file.applicationDirectory + "www/audio/");
how to access all files from any one folder in mobile file manager in ionic 1
cordova-file is what you are looking for.
You can use this function to get all available files in a folder:
function listDir(path){
window.resolveLocalFileSystemURL(path,
function (fileSystem) {
var reader = fileSystem.createReader();
reader.readEntries(
function (entries) {
console.log(entries);
},
function (err) {
console.log(err);
}
);
}, function (err) {
console.log(err);
}
);
}
//example: list of www/ folder in cordova/ionic app.
listDir(cordova.file.applicationDirectory + "directory/path");
see this also: Cordova list all files from application directory (WWW)
Get list of files in a directory in cordova
Just put the console.log in the if-statement:
function success(entries) {
if (entries.length == 0)
console.log("No Records");
else
{
for (var i = 0; i < entries.length; i++) {
entries[i].file(function (file) {
console.log("file.name " + file.name);
})
}
console.log('file list created');
}
}
Accessing Android Environment directories in Cordova
As I found no way to get those folders path with built in cordova functions, I made a quick little plugin that allows to get all the paths exposed through the Environment object.
https://github.com/nicolasgrolleau/androidfoldersplugin/
And that shows how easy building a cordova plugin can be.
Get internal application directory in Cordova + android
from cordova file 3.0.0, the default LocalFileSystem.PERSISTENT
is the /data/data/app.package
on previous versions you can get it using
window.resolveLocalFileSystemURL(cordova.file.applicationStorageDirectory, success, fail);
Related Topics
Why Isn't My Textarea's Placeholder Showing Up
Which Unit I Should Use in CSS When Designing a Web Page
Vertical Scroll Rendering Issue in Flexbox in Firefox
How to Test a Website for Retina on Windows Without an Actual Retina Display
What Is Difference Between <Pre> and <Code> HTML Tag
Change Navbar Breakpoint in Bootstrap 3.3.2
Placing an Image to The Top Right Corner - CSS
Equal Height Columns with Centered Content in Flexbox
How to Add an Offsetted Outline to a CSS Shape
Why Do HTML Entity Names with Dec < 255 Not Require Semicolon
How to Bottom-Align Grid Elements in Bootstrap Fluid Layout
Post Values from a Multiple Select
CSS: Responsive Way to Center a Fluid Div (Without Px Width) While Limiting The Maximum Width
Wrap Table Row to The Next Line