Linux
find Command Builder
Build a find command with the global options in the right position and the -size and -delete traps flagged.
These are emitted before the tests, because GNU find warns when a global option follows one and BSD find ignores it outright.
Becomes a -prune clause, which stops find descending rather than merely hiding the results — the reason it is faster than filtering with -not -path.
Stops find walking into /proc, a network mount or another disk.
Emitted before the path, where it has to go. A link pointing at an ancestor will send find round in a loop.
A glob on the basename only. A pattern containing a slash never matches — use the path pattern for that.
Suffixes are case-sensitive: c bytes, k KiB, M MiB, G GiB. A bare number counts 512-byte blocks, not bytes.
When the contents last changed. Without the minutes box the unit is 24-hour periods, and +7 means strictly more than that many.
find's default action
find . -type f -name '*.log' -size +10M -mtime +7Finds files under . named *.log larger than 10M older than 7 days.
- LowPiping this into xargs will mis-split any filename containing a space. Switch the action to -print0 | xargs -0 if the output is going to another command.
- Info-mtime +7 means strictly more than 7 24-hour periods ago — a file exactly 7 24-hour periods old does not match.
Presets