listfiles

.listfiles path:{String} \
directories:{Boolean = true} \
recursive:{Boolean = false} \
pattern:{String? = null} \
fullpath:{Boolean = true} \
sortby:{FileSorting = FileSorting.NONE} \
order:{Ordering = Ordering.ASCENDING}
-> Iterable<String>

Lists the files located in a directory.

Return

a collection of string values, each representing an entry (file or directory) located in the directory. The collection is unordered when sortby is FileSorting.NONE, and ordered otherwise.

Parameters

path

directory path

directories

whether to include directories in the listing

recursive

whether to recursively list files in nested subdirectories

pattern

optional regular expression to filter entries by name. When non-null, only entries whose file name (always the bare name, regardless of fullpath) matches the pattern are returned.

fullpath

whether to return the absolute path of each file, rather than just the file name

sortby

criterion to sort the files by

Values

order

order to sort the files in

Values

See also

to exclude the extension from file names

Throws

if the directory does not exist, is not a directory, or if pattern is not a valid regular expression

Permissions

project-read
to list files located in the project directory
global-read
to list files located outside the project directory

Wiki page

listing-files