Directory:list(filter) method iterator

Filters the folder content and returns an iterator.

Parameters

filter

A string used to filter folder content. The string can include wildcard characters : an asterisk (*) for one or more characters march or a question mark (?) for single character match.

Return value

Returns an iterator function to be used in a for loop, to iterate over the filtered directory content. Each iterator call returns either a File or a Directory value.

Example

-- iterate through all current directory content for entry in each(sys.Directory("."):list("*.*")) do if type(entry) == "File" then print(entry.name) else -- entry is a directory print(entry.fullpath:match("\\.*\\([%w%p]+)$").."\\") end end