Remove a directory and everything under it. Defensive against symlinks (unlinks the symlink rather than recursing into it). Returns the count of items removed.
Use `find -print0` + `read -d ""` to safely iterate filenames that may contain spaces, newlines, or quotes. Standard bash for-loop over `find` output breaks on these.
`walkdir` recursively iterates every entry under a path, skipping inaccessible directories cleanly. The standard-library alternative requires manual recursion.
`Files.walk` returns a lazy Stream over every entry under a path. Filter with stream operations; remember to close the stream (or use try-with-resources).
Recursively yield every file under a directory matching a predicate. Built on pathlib.rglob; the predicate gives you precise control without listing the whole tree up front.
Mark a recursive function `tailrec` and the compiler rewrites it as a loop — no stack frame per call, no StackOverflowError on deep recursion. Function must end with itself as the FINAL expression.
Yield every file under a directory using a generator and SPL's RecursiveIteratorIterator. Filter by extension or any other predicate without slurping all paths into memory first.