@FINDFIRST[[range...] filename[,[+|-]rhsadecijopt]] : Returns the name of the first file that matches filename, which may include wildcards and/or an include list, and which file has the properties specified in the optional range and attribute parameters.

 

Filename must be in quotes if it contains white space or special characters.

 

If filename is quoted, the returned filename will also be quoted (if necessary).

 

The range and attribute parameters, if included, define properties of the files that will be included in the search as specified in File Selection  Multiple range parameters may be included, but not more than one each of size, date, time, and file exclusion. Range parameters must precede filename. Each range parameter is of the form

 

 /[a...]

 

where a is one of d, s, t, and/or !, followed by the range parameters.

 

On an LFN drive, the returned filename may contain white space or other special characters. Unlike @EXPAND[], no double quotes are added by this function. To avoid problems which could be caused by these characters, quote the returned name before you pass it to other commands. See the notes under Variable Functions for additional details.

 

@FINDFIRST[] locates the first file matching the requirements. To find more matching files, you must use @FINDNEXT[], and terminate the search with @FINDCLOSE[].

 

Warning: @FINDFIRST searches may not be nested!

 

Examples:

 

%@findfirst[/[d-30] *]

 locate files created no more than 30 days ago

 

%@findfirst[/[s2k,3k] "%windir\*.exe",a]

 locate files with the extension exe, the archive flag set, and at least 2,000 bytes but not more than 3,000 bytes long, in the Windows directory.