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