code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(44 lines)
1 '\" t
2 .\" Copyright (c) 2026 Bruce Hill
3 .\" All rights reserved.
4 .\"
5 .TH Path.walk 3 2026-03-14 "Tomo man-pages"
6 .SH NAME
7 Path.walk \- walk a filetree
8 .SH LIBRARY
9 Tomo Standard Library
10 .SH SYNOPSIS
11 .nf
12 .BI Path.walk\ :\ func(path:\ Path,\ include_hidden\ =\ no,\ follow_symlinks:\ Bool\ =\ no\ ->\ func(->Path?))
13 .fi
14 .SH DESCRIPTION
15 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 ARGUMENTS
20 .TS
21 allbox;
22 lb lb lbx lb
23 l l l l.
24 Name Type Description Default
25 path Path The path to begin the walk. -
26 include_hidden Whether to include hidden files (those starting with a \fB.\fR) no
27 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. no
28 .TE
29 .SH RETURN
30 An iterator that recursively walks over every file and subdirectory.
32 .SH NOTES
33 The path itself is always included in the iteration.
35 .SH EXAMPLES
36 .EX
37 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 .EE
43 .SH SEE ALSO
44 .BR Tomo-Path (3)