Skip to content

find: exclude a directory tree #16512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

ronen1n
Copy link

@ronen1n ronen1n commented May 16, 2025

Why its faster:
-prune Stops Recursion: Once it reaches /mnt, it skips it entirely (including subdirectories).
-not -path Scans All Directories: It still traverses into /mnt before filtering, making it slower for large directories.

Excluding /mnt good for excluding win pc files in wsl and excluding external or other mounted drives

Examples:

find / -path '/mnt' -prune -o -name 'zellij' -type f 2>/dev/null

@CLAassistant
Copy link

CLAassistant commented May 16, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers. labels May 16, 2025
@tldr-bot
Copy link

The build for this PR failed with the following error(s):

pages/common/find.md:0: TLDR019 Page should only include a maximum of 8 examples

Please fix the error(s) and push again.

Marged exclude options to one using prune
@sebastiaanspeck sebastiaanspeck changed the title Exclude a directory tree in find.md find: exclude a directorh tree May 17, 2025
@sebastiaanspeck sebastiaanspeck changed the title find: exclude a directorh tree find: exclude a directory tree May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants