enumStart Function

Top  Previous  Next

Starts enumeration of the contents of a folder.


File.enumStart(path [, flags [, folder]])


pathA string with the path to the folder to be enumerated.
flagsAn optional integer with flags indicating if files, folders, or both should be enumerated. If omitted, both files and folders are enumerated.
folderAn optional instance File object representing a folder. If present, path is relative to folder; otherwise, path is from the root.

Return Value

If successful, an instance of a File object that can be used only for enumeration; otherwise an integer with an error code.


Use the typeof operator to determine if the result is an object (success) or a number (failure).


The flags argument should have the value openFile to enumerate files only, or openFolder to enumerate folders only. Those two values may be combined with the + (addition) or | (bitwise OR) operators to specify both files and folders are to be enumerated.


The only methods that may be used on the returned File object are close and enumNext. The close method must be called when enumeration is complete.


See example for the enumNext method.

See Also

enumNext Method