Skip to main content

The "file_list" Function


file_list(dname, attr, [recurse]);
dnamestringThe full path of the target directory, including drive letter
attrinteger/constantEnables filtering results as directories (fa_directory) or files (anything else)
[recurse]booleanOptional: Enables including subdirectories in scan results (disabled by default)


Scans a directory and returns the contents as a ds_list, including relative paths (if any), filenames, and extensions.

The attribute filter and recursive options can only be used on Windows. All other platforms should set attr to 0 and ignore the optional recurse argument.

If the attribute filter is supported and set to fa_directory, only directories will be returned. This is the only supported filter, and all other options will return a list of files instead.


To achieve best processing speed, files without extensions are not supported by this script.


By default, this script can only be used to scan directories within working_directory or elsewhere previously granted access via the get_save_filename function. On desktop platforms, this limitation can be removed by disabling the filesystem sandbox in Game Settings.


var dirs = file_list("C:\\my\\folder", fa_directory, true);
var files = file_list("C:\\my\\folder", 0);