1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
.TH WALK 1
.SH NAME
walk \- walk a path
.SH SYNOPSIS
.B walk
[
.B -dftxu
] [
.B -n
.I mind,maxd
] [
.B -e
.I statfmt
] [
.I name ...
]
.SH DESCRIPTION
.I Walk
recursively descends any directory arguments,
printing the name of each file on a separate line.
When no arguments are given, the working directory
is assumed.
Non-directory arguments are checked for existence,
then printed, if so.
.PP
Options are:
.TP
.B -d
Print only directories.
.TP
.B -f
Print only non-directories.
.TP
.B -t
Print a file only if it has the temporary flag set.
.TP
.B -x
Print a file only if it has any executable bits set.
.TP
.B -u
Unbuffered output.
.TP
.B -n min,max
Set the inclusive range of depths for filtering in results.
Both
.I min
and
.I max
are optional.
A number
.I n
with no comma is equivalent to
.IR 0,n .
.TP
.B -e statfmt
Setting the statfmt string allows specifying the data
.I walk
should print.
It takes a string of characters, each corresponding
to some piece of information about the file being
traversed, and prints them separated by spaces.
.PP
The statfmt characters are as follows:
.TF .
.TP
.B U
owner name (uid)
.TP
.B G
group name (gid)
.TP
.B M
name of last user to modify (muid)
.TP
.B a
last access time (atime)
.TP
.B m
last modification time (mtime)
.TP
.B n
final path element (name)
.TP
.B p
path
.TP
.B q
qid path.version.type (see
.IR stat (2))
.TP
.B s
size in bytes
.TP
.B x
permissions
.TP
.B D
server device
.TP
.B T
server type (kernel device rune)
.PD
.PP
The default statfmt is simply,
.IR p .
.SH EXAMPLES
List files in a directory, sorted by modification time.
.IP
.EX
walk -femp catpics | sort -n | sed 's/^[^ ]+ //'
.EE
.PP
Print the size and path of files (excluding dirs)
in the working directory.
.IP
.EX
walk -fn1 -esp
.EE
.PD
.SH SOURCE
.B /sys/src/cmd/walk.c
.SH SEE ALSO
.IR ls (1),
.IR du (1)
.SH BUGS
Statfmt character `x' displays permissions as an integer.
.PP
Manipulating ifs is a nuisance.
.PP
File names are assumed to not contain newlines.
.PP
Correct invocation requires too much thought.
.SH HISTORY
.I Walk
first appeared in 9front (March, 2019).
|