walk – walk a path

walk [ –dftxu ] [ –n mind,maxd ] [ –e statfmt ] [ name ... ]

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.

Options are:
d    Print only directories.
f    Print only non–directories.
t    Print a file only if it has the temporary flag set.
x    Print a file only if it has any executable bits set.
u    Unbuffered output.
n min,max
Set the inclusive range of depths for filtering in results. Both min and max are optional. An argument of n with no comma is equivalent to 0,n.
e statfmt
Specify the output format. Each character in statfmt specifies a file attribute to display. The printed attributes are separated by spaces.

The statfmt characters are as follows:
U   owner name (uid)
G   group name (gid)
M   name of last user to modify (muid)
a   last access time (atime)
m   last modification time (mtime)
n   final path element (name)
p   path
q   qid path.version.type (see stat(2))
s   size in bytes
x   permissions
D   server device
T   server type (kernel device rune)

The default statfmt is simply, p.

List files in a directory, sorted by modification time.
walk –femp catpics | sort –n | sed 's/^[^ ]+ //'

Print the size and path of files (excluding dirs) in the working directory.
walk –fn1 –esp


ls(1), du(1)

Manipulating ifs is a nuisance.

File names are assumed to not contain newlines.

Correct invocation requires too much thought.

Walk first appeared in 9front (March, 2019).