Skip to content

find

FunctionRecursively lists page or space paths, or searches page bodies with -exec grep.
Options-name PATTERN, -maxdepth N, `-mtime [+
LimitationsAt most one PATH. Default -maxdepth is 5. Results cap at 5000 paths; child fetches (walk) or CQL pages (-mtime) cap at 250; -exec grep fetches at most 100 bodies.

With no PATH, find searches under the current directory (same as find .). It prints matching paths, one absolute path per line (leading /, same style as pwd).

Without -mtime, it prints the start path, then descendants depth-first. With -mtime, results come from the CQL search index (last update = content version when) and are sorted by path segments (parent before child). That order can differ from a plain walk. The index may lag ls -l by seconds to minutes after edits.

PredicateMeaning
-name PATTERNMatch the space or page title. * matches any sequence; ? matches one character (same as ls).
-maxdepth NLimit depth from the start path. 0 is only the start path; 1 is the start path plus direct children. An explicit -maxdepth always wins, including values higher than 5. Unchanged when -mtime is given, so those results stay a subset of a plain find.
`-mtime [+-]N`
-prunePrint a matching node and do not descend under it. With -mtime, keeps the top-most matches so find … | mv -n DEST does not flatten parent and child. Without -mtime, the walk is unchanged aside from honoring -prune.
-exec grep …Last action only. For each path find would print, fetch the page body and run grep. v1 supports grep only.

find … | grep PATTERN filters path strings. find … -exec grep PATTERN searches page bodies.

-exec grep reuses grep’s -i / -v / -n / -c. Default output is a path header plus matching lines (pages with no matches are omitted). With -c, each hit is path:count.

PATH and predicates may appear in any order before -exec. Prefer -prune and mv -n when piping stale pages into Archive so children are not moved beside their parents.

$ find
$ find .
$ find ./MySpace
$ find -name Alpha*
$ find ./MySpace -maxdepth 1
$ find -name '*Notes*' -maxdepth 3
$ find ./MySpace | head 20
$ find ./MySpace -mtime +365
$ find . -name '*Notes*' -mtime +180 -maxdepth 5
$ find ./MySpace/Projects -mtime +365 -prune | mv -n ./MySpace/Archive
$ find ./MySpace/Projects -mtime +365 -prune | head 100 | mv ./MySpace/Archive
$ find ./MySpace -maxdepth 2 -exec grep error
$ find -name '*Notes*' -exec grep -i TODO
$ find ./MySpace -exec grep -c error
$ find ./MySpace | grep Notes
$ find ./folder -name 'Draft*' | mv -n ./Archive

While working…, press Esc or Ctrl+C to abort (conshell: interrupted). If a cap is hit, Shell prints paths collected so far, then a marker asking you to refine with -maxdepth or -name.