1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:47:46 +00:00

find: Allow '+' and '-' prefix for -links and -size options

The presence of this prefix denotes that the value being tested is
strictly greater than or less than the given numeric value.
This commit is contained in:
Tim Ledbetter 2023-09-05 17:49:15 +01:00 committed by Andrew Kaster
parent 773a64aa5a
commit 331991f9c4
2 changed files with 78 additions and 15 deletions

View file

@ -27,13 +27,17 @@ specified commands, a `-print` command is implicitly appended.
* `-type t`: Checks if the file is of the specified type, which must be one of
`b` (for block device), `c` (character device), `d` (directory), `l` (symbolic
link), `p` (FIFO), `f` (regular file), and `s` (socket).
* `-links number`: Checks if the file has the given number of hard links.
* `-links [-|+]number`: Checks if the file has the given number of hard links.
* `-user name`: Checks if the file is owned by the given user. Instead of a user
name, a numerical UID may be specified.
* `-group name`: Checks if the file is owned by the given group. Instead of a
group name, a numerical GID may be specified.
* `-size number[bcwkMG]`: Checks if the file uses the specified `n` units of
space rounded up to the nearest whole unit.
* `-size [-|+]number[bcwkMG]`: Checks if the file uses the specified `n` units of
space rounded up to the nearest whole unit.
The '+' and '-' prefixes denote greater than and less than, i.e an exact size
of `n` units doesn't match. Sizes are always rounded up to the nearest unit,
empty files, while the latter will match files from 0 to 1,048,575 bytes.
The unit of space may be specified by any of these suffixes:
@ -83,6 +87,11 @@ operators:
* `command1 -a command2`, `command1 command2`: Logical AND.
* `( command )`: Groups commands together for operator priority purposes.
Commands which take a numeric argument `n` (`-links` and `-size` for example),
may be prefixed by a plus sign ('+') or a minus sign ('-'). A plus sign means
"grater than `n`", while a minus sign means "less than `n`". A numeric argument
with no prefix means "exactly equal".
## Examples
```sh