# Scanning Native Directories

> [HTML Version](scanningnativedirectories.htm)

You can scan a native directory to build a list of files in one of two ways. The first way would be to use HOSTEX[xs](keyword-types.md) to launch a native operating system utility to build such a list and output it to a file, and then open the file for input to read it in. This works better in Unix than in Windows, which doesn’t have a standard way of generating a directory list in a file.

The second way is to use [MX\_FINDFIRST](mx_findfirst.md) and [MX\_FINDNEXT](mx_findnext.md) to scan the directory. Start with MX\_FINDFIRST to position your "directory cursor" at the start of a specified directory, and then use MX\_FINDNEXT repeatedly until it returns a non-zero status, indicating it has hit the end of the directory. 