File.listFiles filtering on file extension

File.listFiles filtering on file extension

BY 21 Feb 2017 Web Application Development

I am trying to list the files with a specific extension (i.e. *.gpx), so I thought I would do

window.tizen.filesystem.resolve('documents', function (fs) {
  fs.listFiles(function (files) {
    for (var i in files) { console.log(files[i].fullPath); }; },
  null, { name: '%.gpx' });
});

However, that doesn’t return any results (and, of course, there are some gpx files there); using a slightly different filter seems to work as expected:

window.tizen.filesystem.resolve('documents', function (fs) {
  fs.listFiles(function (files) {
    for (var i in files) { console.log(files[i].fullPath); }; },
  null, { name: 'A%.gpx' });
});

But that doesn’t really do what I want… How can I get all files with a specific extension?

BTW, I am using the mobile 3.0 emulator…

Written by