glob
result = list_files([dir], [pattern], [filter=], [contains=], [size=], [recursive=])
Input: dir, pattern, filter, contains, size, recursive · Output: result
What it is
Every file matching a whole-path wildcard, as full paths, sorted — never a directory, which is what makes the content and size filters mean something on every entry. dir is a directory to search and pattern a wildcard to match (* and ? stay inside one path segment, ** crosses them); a single argument is read as a pattern when it holds a wildcard and as a directory when it does not. filter= is the keyword spelling of the pattern; contains= keeps only files whose bytes hold that text; size= compares against the byte size (">2MB", "<=100KB", "=0", with 1024-based units); recursive= searches subdirectories without writing ** yourself. glob is the same search with no filters, under the name most other languages give it.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = list_files([dir], [pattern], [filter=], [contains=], [size=], [recursive=]) | dir optionaldir is a directory to search and pattern a wildcard to match (* and ? stay inside one path segment, ** crosses them).pattern optionala single argument is read as a pattern when it holds a wildcard and as a directory when it does not.filter optionalfilter= is the keyword spelling of the pattern.contains optionalcontains= keeps only files whose bytes hold that text.size optionalsize= compares against the byte size (">2MB", "<=100KB", "=0", with 1024-based units).recursive optionalrecursive= searches subdirectories without writing ** yourself. | result List or Str | Returns a List of Str, empty when nothing matched. |
Examples
No documentation example calls this form yet. The File I/O chapter is where one belongs.
See also
list_files — documented in the same entry.