Page tree
Skip to end of metadata
Go to start of metadata

Introduced in




Returns an array with all matching files and folders found in the specified directory. Does not search sub-folders.

The element syntax and data differ between unpacked and exported (packed) missions:

Unpacked Mission
listfiles ["","subfolder\*.paa",false,false]; // empty array <-- does not support folders in the file filter
listfiles ["subfolder","*.paa",false,false]; // filtered array of files: [["file","subfolderpath"],...] <-- split output requires path combination when the file needs to be called
Packed Mission
listfiles ["","subfolder\*.paa",false,false]; // subfolder filter (1) included, [["subfolder\file",""],...] <-- path inclusion clutters file lists, but streamlines calling the files
listfiles ["subfolder","*.paa",false,false]; // subfolder filter (0) ignored, [["subfolder\file",""],...] <-- filter that works with unpacked missions does not work with packed missions


Syntax:listFiles [dir, fileMask, profileDir, absoluteDir]
  • dir: String - Sub-folder to search in.

  • fileMask: String - Mask of filename to search for. Wildcards are supported (uses "*" and "?").
  • profileDir: Boolean - If true, dir is searched relatively to the user profile folder. If false, dir is relative to the mission directory.
  • absoluteDir: Boolean - If true, dir can be an absolute path (in which case, profileDir is ignored).
Return Value:Array - Array of files / folders in the searched folder. The format of each array element is: ["filename", "dir\filename"]. If nothing is found, an empty array is returned.


Lists all mission folders in the user profile directory:
listFiles ["mpmissions", "*.*", true]
Lists all files in the mission folder:
listFiles ["", "*.*", false]
Lists all files at the root level of C:\:
listFiles ["C:\", "*.*", false, true]

Additional Information

See also: getDirectory