|mask||The mask to use for searching.|
|attr||The specific file attribute to look for.|
This function will return the name of the first file that
satisfies the mask and the attributes. If no such file exists, then
an empty string is returned. The mask can contain a path and can
contain wildchars, for example 'C:\temp\*.doc'. The attributes give
the additional files you want to see, so the normal files are
always returned when they satisfy the mask. You can add up the
following constants to see the type of files you want (if you do
not wish to add any attributes, use 0):
- fa_readonly - read-only files
- fa_hidden - hidden files
- fa_sysfile - system files
- fa_volumeid - volume-id files
- fa_directory - directories
- fa_archive - archived files
WARNING! This function may not work as you expect due to GameMaker: Studio being sandboxed! Please see the section on File System Limits for more information.
NOTE: This function will not work at all on the JS target platforms (Windows8, Tizen, and HTML5), and the filter flags will only work on Windows and WinPhone (use 0 for all other platforms).
if directory_exists("\User Content")
file = file_find_first("\User Content\*.doc", fa_readonly);
This will check to see if the specified directory exists then, if it does, go there and return the first "read only" doc file found.