Parsing files and/or folders through KiX is not that difficult.  Some confusion stems from the fact that older KiX manuals had bad examples.  The 4.02 version is correct.

DIR()

Action: DIR can be used to enumerate the files in a directory.  Dir returns a string representing the name of a file, directory, or folder that matches a specified pattern.  To retrieve subsequent entries in a directory, specify an empty string (“”) as the path.

Syntax: DIR ("path", index)

Parameters:
Path
Optional string that specifies a file name — may include directory or folder, and drive.  If path is empty (“”), Dir will return the next file of the previously opened enumeration handle.  Wildcards (‘*’ and ‘?’) are supported.

Index
Optional number indicating which enumeration handle to use.  The Dir function can enumerate two directories at the same time.  To open the second enumeration handle, specify 1 for the index.

Returns:
Returns a string representing the name of a file, directory, or folder that matches a specified pattern.  An empty string ("") is returned if path is not found or to indicate that the end of the current enumration was reached.  Dir also sets the value of @ERROR:
 0 DIR successful.
 Error code Function failed.


Example:
$FileName = Dir("C:\TEMP")
While $FileName <> "" and @ERROR = 0
  ? $FileName
  $FileName = Dir() ; retrieve next file
Loop

--------
The above example is fine if you're running KiX 4.xx, but for KiX 3.6x, you need to specify $FileName = Dir("C:\TEMP\*.*") instead.

The basic conditional $FileName <> "" and @ERROR = 0 is shown in the above example, but there are others that make DIR more useful.

If ($Name <> ".") And ($Name <> "..") can be used to filter out the first two entries.

If (GetFileAttr($basedir+"\"+$name) & 16) will filter out files, showing only folders.  Add a NOT to it and you filter out folders, showing only files.

break on
$basedir = "C:\Program Files"
$Name = Dir("$basedir")
While $Name <> "" and @ERROR = 0
  If ($Name <> ".") And ($Name <> "..") And (GetFileAttr($basedir+"\"+$name) & 16)
    ? $basedir+"\"+$name
  EndIf
  $Name = Dir()
Loop
get $_

Note: Portions of this were taken from the HTML help file created and compiled by ScriptLogic Corporation.

[ 15 March 2002, 02:19: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.