Lets Suppose I have a folder in android, it may be in internal or external storage: "VIKAS KOHLI" folder and I want to check in "VIKAS KOHLI" whether there is any .mp4 file or not. Then how can I check this by using cordova?
Thanks in advance!
You need to use the File plugin. Some basic example code here:
window.resolveLocalFileSystemURL(DIR_FULL_PATH, function(dirEntry) {
var directoryReader = dirEntry.createReader();
console.log(dirEntry);
// Get a list of all the entries in the directory
directoryReader.readEntries(success,fail);
});
function success(entries) {
var i;
for (i=0; i<entries.length; i++) {
//Here you can check the entries ofject for the file name and do stuff
console.log('En - ', entries[i]);
}
}
function fail(error) {
console.log("Failed to list directory contents: ", error);
}
Reference to the file plugin: https://github.com/apache/cordova-plugin-file