Purpose

Gets the list of files within a given directory based on an optional search filter.

Syntax

bool GetDirectoryFileList(String pathToDirectory, String searchFilter);

  • pathToFileOrDirectory: The path to the directory to list the files.
  • searchFilter: The search filter to use. For example, “.” or “*.txt”.

Example

function Update()
{
    var listOfFiles = GetDirectoryFileList("C:\\myFolder\\", "*.txt");
    for(i = 0; i < listOfFiles.length; ++i)
    {
        var pathToFile = listOfFiles[i];
        Log("filename: " + pathToFile);
    }
}