JScript methods of reading directory

Have discovered 2 methods of reading items in a directory using JScript,
new Enumerator(clickData.func.sourcetab.files)
are there any more ? and which is the fastest method?

I'd imagine the first one should be faster (more efficient), since you already have the list of files in the sourcetab.files (the Enumerator simply wraps the existing data into an iterable object).

The second one, I believe, reads the dir contents again rather than fetching existing data from the sourcetab.files

If I am not mistaken then...

If anything has changed, or might have changed, then the enumerator method should be preceded by a sourcetab.update() whereas readdir() will always provide current information.

The first method will have the same sort order as in source, the second method will always be sorted alphanumeric.

Enumerating tab.files will only return files, no folders. The number of files in the tab might be reduced by filters or increased by Flatview.

Reading tab.path will always return the complete content of the directory, optionally recursively.

For more methods, check Windows' Folder object.