Garry's Mod Wiki

Garry's Mod Wiki

  boolean file.Exists( string name, string gamePath )

Description

Returns a boolean of whether the file or directory exists or not.
If you want to check for a directory, file.IsDir will be faster since it won't check for files.

Arguments

1 string name
The file or directory's name. ( You must include the file extension for files, for example "data.txt" )
2 string gamePath
The path to look for the files and directories in. See this list for a list of valid paths.

Returns

1 boolean
Returns true if the file exists and false if it does not.

Example

Prints whether the data folder exists in the base directory.

print( file.Exists( "data", "GAME" ) )
Output:
true

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...