Table of Contents

ListFolder

(Information and examples taken from the DroidScript documentation)

Description

The ListFolder method lists all the files and sub folder names in a given path to a comma seperated list.

The 'filter' parameter is an optional text parameter which allows you to specify a filter pattern. For example to find only mp3 files, you would specify “.mp3” as a filter

Note: ListFolder returns a JavaScript array.

 list = app.ListFolder( path, filter, limit, options );

Example - Basic

function OnStart()
{
  list = app.ListFolder( "/sdcard/" );
  app.ShowPopup( list );
}

Example - Filtered

function OnStart()
{
  list = app.ListFolder( "/sdcard", ".mp3" );
  app.ShowPopup( list );
}

Example - Limited

function OnStart()
{
  //Find first ten mp4 files on internal sdcard.      
  mp4List = app.ListFolder( "/sdcard", ".mp4", 10 ); 
  app.ShowPopup( mp4List );
}

Options

alphasort sort a list of folders in alphabetical order
FullPath returns a list with the Fullpath of the content