Note -name is case-sensitive; use -iname for case-insensitive. -mtime -7 means modified in the last 7 days. -exec runs a command on each result; use + instead of \; to batch them for better performance.
Note -r searches recursively through directories. -n shows line numbers. -i is case-insensitive. -v inverts the match (shows non-matching lines). -c counts matches. -l lists only filenames with matches. Use -E for extended regex or egrep.
from pathlib import Path
# All Python files in current directoryfor py_file in Path(".").glob("*.py"):
print(py_file.name)
# Recursive search
all_json = list(Path(".").rglob("*.json"))
print(f"Found {len(all_json)} JSON files")
Note glob() searches one level. rglob() searches recursively through all subdirectories. Both return Path objects.