Skip to content

--exclude doesn't work with absolute paths #851

Open
@morganmay

Description

@morganmay

Describe the bug you encountered:

The examples for the --exclude or -E option imply that it should work with absolute paths (/mnt/external-drive is given as an example). However, it only seems to work with relative paths. For example, if I'm trying to exclude the directory /home/user/Library/:

fd -E Library pattern /home

works, as does

fd -E "*/Library/*" pattern /home

However,

fd -E /home/user/Library/ pattern /home

doesn't work (i.e. /home/user/Library/pattern.txt would still show up in search results ). Adding other options, such as -p or -a doesn't seem to affect this behavior.

The only way I've found to exclude absolute paths is to add them to ~/.config/fd/ignore, which is sowewhat inconvenient.

What version of fd are you using?

fd 8.2.1

Which operating system / distribution are you on?

Linux 5.14.2-arch1-2 x86_64
LSB Version:    1.4
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions