Revision Difference
file.Find#517600
<function name="Find" parent="file" type="libraryfunc">
<description>Returns a list of files and directories inside a single folder.</description>
<realm>Shared and Menu</realm>
<args>
<arg name="name" type="string">The wildcard to search for. "models/*.mdl" will list .mdl files in the models/ folder.</arg>
<arg name="path" type="string">The path to look for the files and directories in. See [this list](/gmod/File_Search_Paths) for a list of valid paths.</arg>
<arg name="path" type="string">The path to look for the files and directories in. See <page text="this list">File_Search_Paths</page> for a list of valid paths.</arg>
<arg name="sorting" type="string" default="nameasc">The sorting to be used, optional.

* "nameasc" sort the files ascending by name
* "namedesc" sort the files descending by name
* "dateasc" sort the files ascending by date
* "datedesc" sort the files descending by date</arg>
</args>
<rets>
<ret name="" type="table">A table of found files, or nil if the path is invalid</ret>
<ret name="" type="table">A table of found directories, or nil if the path is invalid</ret>
</rets>
</function>
<example>
<description>Prints the first file and the first directory in the `data` folder.</description>
<code>
local files, directories = file.Find("*", "DATA")
print( "File: " .. files[1], "Folder: " .. directories[1] )
</code>
<output>
&lt;br /&gt; File: helloworld.txt&lt;br /&gt;
Folder: ctp
</output>
</example>