Back

ListFolder

Hello World

The ListFolder method returns a list of all files and folders in a given folder.

app.ListFolder( path, filter, limit, options ) → list: [ paths ]

The filter parameter is an can be used to specify a filter pattern. For example to find only mp3 files, you would specify “.mp3” as a filter

The You can also optionally sort the list in alphabetica order with the “alphasort” option.

See Also: IsFolder, CreateList

Example - List home directory

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

    ldg = app.CreateListDialog( "/sdcard/*", list );
    ldg.Show();
}
    Copy     Copy All       Run      

Example - List .jpg assets

function OnStart()
{
    var list = app.ListFolder( "/Sys/Img", ".jpg" );

    ldg = app.CreateListDialog( "/Sys/Img/*.jpg", list );
    ldg.Show();
}
    Copy     Copy All       Run      
string
number: integer
string: path to file or folder ( “/absolute/...” or “relative/...” )
string: comma “,” separated: Alphasort, FullPath, RegEx, Folders, Files