b = dirlist(list_to_receive_paths, directory_path
ʃ, filter := wildcardʅ
ʃ, recursive := recursive_flagʅ);
The
dirlist function fills
list_to_receive_paths, a string
List, with the paths of files and directories located in a directory specified by
directory_path. The paths included in the List are fully evaluated absolute paths. Hidden and system files are not included in the directory listing.
The directory_path can be one of the following:
- A string expression specifying a directory.
- One of the path types documented in the pathname function.
- A media type, which will list the files of the specified media type on Android. These files can reside in multiple directories.
Using
named arguments, you can specify a string expression,
wildcard, that is applied to filter the paths added to the string List. For example,
"*.csdb" would include only
CSPro DB data sources. You can specify multiple wildcard filters by separating each filter with a semicolon. The filter
"*.jpg;*.jpeg;*.bmp" would include both JPEG and BMP files. Instead of using a string expression, you can also use a predefined wildcard expression:
- FileType.Audio: Files that the Audio object can read and write.
- FileType.Geometry: Files that the Geometry object can read and write.
- FileType.Image: Files that the Image object can read and write.
By default, only files and directories located in the directory are added to the List. To recursively add paths, creating a listing of the specified directory as well as any subdirectories, set the numeric expression
recursive_flag to
true.
The function returns a logical value of
1 (
true) if successful and
0 (
false) if the directory does not exist or cannot be accessed. If the List is read-only, the function returns
default.
// get a list of all shared images on Android that can be loaded using the image object
List string image_files;
dirlist(image_files, Media.Images, filter := FileType.Image);