Kernel 8.0 APIs Banner
Office of Information and Technology (OIT) Banner
[skip navigation]

$$LIST^%ZISH(): List Directory

Reference Type: Supported, Category: Host Files, ICR#: 2320

Description

The $$LIST^%ZISH extrinsic function returns a list of file names in the current directory. The list is returned in an array in the variable named by the third parameter.

Format

  $$LIST^%ZISH(path,arrname,retarrnam)

Input Parameters

path:

(required) Full path, up to but not including any filename. For current directory, pass the NULL string.

arrname:

(required) Fully resolved array name containing file specifications to list at the next descendent subscript level.

For example, to list all files, set one node in the named array, at subscript *, equal to NULL. To list all files beginning with E and L, using the ARRAY array, set the nodes:

  ARRAY("E*")=""
  ARRAY("L*")=""

Pass the name ARRAY as the arrname parameter. You can use the asterisk wildcard in the file specification.

retarrnam:

(required) Fully resolved array name to return the list of matching filenames. You should ordinarily KILL this array first (it is not purged by LIST^%ZISH).

Output Parameters

retarrnam:

$$LIST^%ZISH populates the array named in the third input parameter with all matching files it finds in the directory you specify. It populates the array in the format:

  ARRAY("filename1")=""
  ARRAY("filename2")=""
  (etc.)

Output

returns:

Returns:

  • 1—Success.

  • 0—Failure.

Example

>K FILESPEC,FILE
>S FILESPEC("L*")="",FILESPEC("P*")=""
>S Y=$$LIST^%ZISH("","FILESPEC","FILE")