file.filesInFolder

Syntax file.filesInFolder (path, level)

Params path is the path to a folder.

level determines how deep the traversal goes:

If level = 1, file.filesInFolder doesn't go into any sub-folders.

If level = 2, it also counts the files in any sub-folders.

If level = infinity, it counts files at all levels, nesting into folders inside of sub-folders, and so forth.

Action Counts the number of files in the indicated folder and, optionally, sub-folders.

Returns The number of files or folders at the specified path.

Examples file.filesInFolder ("C:\\Program Files\\Frontier\\", 1)
21

file.filesInFolder ("C:\\Program Files\\Frontier\\", infinity)
985

file.filesInFolder ("System:System Folder:", 1)
54

file.filesInFolder ("System:System Folder:", infinity)
251

Notes This verb determines the count by traversing the whole structure, which can be time-consuming.

The folder at the specified path is counted. In other words, if path specifies a folder which contains a single file, then the return value will be 2.

See Also file.foldersInFolder

Discuss