find Command Examples

Find files or directories under a directory tree, recursively. More information: https://manned.org/find.

find {{root_path}} -name '{{*.ext}}'

find {{root_path}} -path '{{**/path/**/*.ext}}' -or -name '{{*pattern*}}'

find {{root_path}} -type d -iname '{{*lib*}}'

find {{root_path}} -name '{{*.py}}' -not -path '{{*/site-packages/*}}'

find {{root_path}} -maxdepth 1 -size {{+500k}} -size {{-10M}}

find {{root_path}} -name '{{*.ext}}' -exec {{wc -l}} {} \;

find {{root_path}} -daystart -mtime {{-1}} -exec {{tar -cvf archive.tar}} {} \+

find {{root_path}} -type {{f}} -empty -delete