55 lines
1.7 KiB
JSON
55 lines
1.7 KiB
JSON
{
|
|
"name": "find",
|
|
"section": 1,
|
|
"title": "find files",
|
|
"synopsis": ["find [PATH...] [EXPRESSION]"],
|
|
"description": "Walks a directory tree with predicates including -maxdepth, -mindepth, -name, -iname, -path, -regex (full path, JS RegExp), -type, -empty, -mtime, -newer, -prune, -delete (gated by BARE_OS_FIND_DELETE), -exec/-ok … \\; (requires ctx.runBinCommand; BARE_OS_FIND_EXEC_MAX, default 64; -ok needs BARE_OS_FIND_OK=1), and -print0. Not full POSIX find grammar.",
|
|
"options": [
|
|
{
|
|
"flag": "-name / -iname",
|
|
"meaning": "Base name glob match (case-sensitive / case-insensitive)"
|
|
},
|
|
{
|
|
"flag": "-regex PAT",
|
|
"meaning": "Full path must match JavaScript RegExp PAT"
|
|
},
|
|
{
|
|
"flag": "-exec / -ok",
|
|
"meaning": "Run a utility with {} replaced by path; terminate with ;"
|
|
},
|
|
{
|
|
"flag": "-print0",
|
|
"meaning": "Separate paths with NUL (requires host stdout)"
|
|
},
|
|
{
|
|
"flag": "-type f|d|l",
|
|
"meaning": "Restrict to file, directory, or symlink"
|
|
}
|
|
],
|
|
"keywords": ["find", "directory", "walk", "search"],
|
|
"bareOsNotes": "Expression syntax is a simplified subset.",
|
|
"examples": [
|
|
{
|
|
"caption": "files by name glob",
|
|
"code": "find . -name \"*.js\""
|
|
},
|
|
{
|
|
"caption": "directories only",
|
|
"code": "find . -type d"
|
|
},
|
|
{
|
|
"caption": "max depth",
|
|
"code": "find . -maxdepth 2 -type f"
|
|
},
|
|
{
|
|
"caption": "skip top directory level (GNU-like -mindepth 2)",
|
|
"code": "find . -mindepth 2 -type f"
|
|
},
|
|
{
|
|
"caption": "case-insensitive name",
|
|
"code": "find . -iname \"*.TXT\""
|
|
}
|
|
],
|
|
"listCategory": "coreutils"
|
|
}
|