DOS Fn 4eH: Find 1st Matching File
Expects: AH 4eH
DS:DX address of ASCIIZ▲ filespec to find (wildcards▲ OK)
CX file attribute to match
Returns: AX error code if CF is set to CY
DTA is filled with a FileInfoRec (if no error)
Info: Searches a single directory for a file matching a specific
wildcard▲ filespec with a given file attribute and returns file
information into the current DTA.
You may use this to obtain a file's size, time, date, etc.
without needing to open the file.
DS:DX points to an ASCIIZ string in the form...
If the drive or path is omitted, defaults are assumed.
DOS finds the name of the first file on the drive and directory
that matches the filespec and attribute, and places that name and
other information into the DTA, in the form of a FileInfoRec.
Notes: The file attribute is generally used in an inclusive search.
For instance, if you want to look for directories as well as
filenames, attribute bit 4 should be set (attr | 10H). See
File Attributes for full information.
A typical sequence used to find all matching files in a
■ Use Fn 1aH to set the DTA to a local buffer (or use the
default DTA at PSP offset 80H)
■ Set CX=attribute, DS:DX => ASCIIZ wildcard d:\path\filespec
■ Invoke Fn 4eH (Find First)
■ If CF indicates error, you're all done (no matches)
■ Set DS:DX => DTA (or to data you've copied from the DTA after
using Fn 4eH)
Process the filespec and data at DS:DX
Invoke Fn 4fH (Find Next)
Until error return indicates no match (Carry Flag is set)
See Also: Fn 4fH (find next file)
Fn 1aH (set DTA)
Directory and File Functions