Skip to content

[BUG] --exclude does not work when directory's name ends with dot(.). #1667

Open
@nemonein

Description

Checks

  • I have read the troubleshooting section and still think this is a bug.

Describe the bug you encountered:

Hello.
I'm on Archlinux, using fd 10.2.0 and zsh.

If a directory's name ends with .(dot), and if the directory is being excluded by --exclude, fd does not do the job.
For example,

$ ls -l
drwxr-xr-x 1 nemo nemo 1.2K 2025-02-01 22:41  abcfoobar.
drwxr-xr-x 1 nemo nemo 1.2K 2025-02-01 22:44  abcfoobarzoo
drwxr-xr-x 1 nemo nemo  184 2025-02-01 23:18  xyzbarfoo
.... (many other dirs...)

I have a directory named abcfoobar., abcfoobarzoo, and xyzbarfoo.

$ fd --exclude=abcfoobar. --exclude=xyzbarfoo | rg 'abcfoobar|xyzbarfoo'
1:1:abcfoobarzoo/
2:1:abcfoobar./
3:1:abcfoobar./fd_file_practice_deleteit
4:1:abcfoobar./2-chrome-kjbdgfilnfhdoflbpgamdcdgpehopbep-Default.desktop
5:1:abcfoobar./2-chrome-kdhdkmeileofnlbnpndjkbgiemlhgmmd-Default.desktop
6:1:abcfoobar./2-chrome-jgcngmnmmbofobnpbddpeedpiaiogpdh-Default.desktop
7:1:abcfoobar./2-chrome-famcjndkpfkjbdmdjokfbokncecponlc-Default.desktop
8:1:abcfoobar./2-chrome-eilembjdkfgodjkcjnpgpaenohkicgjd-Default.desktop
9:1:abcfoobar./2-chrome-cgjkcjhllhgpdlnpdlfoollgddkoopgn-Default.desktop
10:1:abcfoobar./2-chrome-agimnkijcaahngcdmfeangaknmldooml-Default.desktop
11:1:abcfoobar./2-chrome-abhlffefmlmfknmhmpkbnekffhfphmjn-Default.desktop
12:1:abcfoobar./2-albert-windows-rule3.kwinrule
13:1:abcfoobar./2-albert-windows-rule2.kwinrule
14:1:abcfoobar./2-albert-windows-rule.kwinrule

To make it work, I have to try something else.

$ fd --exclude='abcfoobar.*' --exclude=xyzbarfoo | rg 'abcfoobar|xyzbarfoo'
1:1:abcfoobarzoo/

'abcfoobar.*' is not regex, because it does not exclude 'abcfoobarzoo'.


Is is as intended?
If so, please describe this on the README.
Also, on the README, the example is not a good one.

> fd -E /mnt/external-drive …

However, --exclude is relative to the starting directory, said @tavianator.
This also has to be mentioned on the README.

Describe what you expected to happen:

No response

What version of fd are you using?

10.2.0

Which operating system / distribution are you on?

Linux 6.12.10-arch1-1 x86_64
Archlinux, KDE Plasma6, with zsh.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions