(44 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Path.walk 3 2026-03-14 "Tomo man-pages"6 .SH NAME7 Path.walk \- walk a filetree8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Path.walk\ :\ func(path:\ Path,\ include_hidden\ =\ no,\ follow_symlinks:\ Bool\ =\ no\ ->\ func(->Path?))13 .fi14 .SH DESCRIPTION15 Returns an iterator that efficiently recursively walks over every file and subdirectory in a given directory. The iteration order is not defined, but in practice it may look a lot like a breadth-first traversal.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 path Path The path to begin the walk. -26 include_hidden Whether to include hidden files (those starting with a \fB.\fR) no27 follow_symlinks Bool Whether to follow symbolic links. Caution: if set to 'yes', it is possible for this iterator to get stuck in a loop, using increasingly large amounts of memory. no28 .TE29 .SH RETURN30 An iterator that recursively walks over every file and subdirectory.32 .SH NOTES33 The path itself is always included in the iteration.35 .SH EXAMPLES36 .EX37 for p in (/tmp).walk()38 say("File or dir: $p")40 # The path itself is always included:41 assert [p for p in (./file.txt).walk()] == [(./file.txt)]42 .EE43 .SH SEE ALSO44 .BR Tomo-Path (3)