JavaScript

{dialog.object}phoneGapListFilesURL Method

Syntax

{dialog.object}.phoneGapListFilesURL(dirPath, filter, onSuccess, onError);

Arguments

dirPath

The URL of the directory containing the files. The directory name must end in a forward slash '/'.

filter

A regular expression used to filter the files.

onSuccess

A javascript function called if the call is successful. It takes one parameter, filelist, an array of strings representing each matching file found in the directory.

onError

A javascript function that is called if an error occurs.

Description

Lists files in a directory. If a filter, defined with a regular expression, is specified, only files that match the filter are listed.

Example

var onSuccess = function(filelist) { 
	alert("Files were found.");
};
var error = function(e) { 
	alert("Encountered an error!");
};
var baseURI = {dialog.object}.phoneGapGetLocalDirURL('private');
var dirName = 'dir1';
var filter = '*.txt';
var dirPath = baseURI + dirName;
{dialog.object}.phoneGapListFilesURL(dirPath, filter, onSuccess, onError);