Skip to content

FileExists

Anthony Headley edited this page Apr 21, 2020 · 2 revisions

FileExists(string: filename) : bool

Brief:

Takes a full file path and returns true if the file exists and false if not.

Paramiters:

Name Description Optional
string: filename Full path of the file to check

Returns:

bool : true = file exists bool : false = file does not exist

Examples:

    local sep = GetPathSeparator()
    -- navigate to the demoshows path
    local path = Root().Temp.DriveCollect[1].path .. sep .. ".." .. sep .. "demoshows"
    -- build two shows files to look for
    local files = {}
    files[1] = path .. sep .. "Demoshow_Fullsize_and_Light.show"
    files[2] = path .. sep .. "randomfilename.random"

    -- loop through the above files and echo the result of the file
    for key, value in pairs(files) do
            if FileExists(value) then
            Echo(value .. " - Exists")
        else
            Echo(value .. " - Does not exist")
        end
    end
Clone this wiki locally