Skip to content
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

Add item count feature #1296

Open
davecoutts opened this issue Apr 2, 2023 · 1 comment
Open

Add item count feature #1296

davecoutts opened this issue Apr 2, 2023 · 1 comment

Comments

@davecoutts
Copy link

The parallelized directory traversal feature in fd makes it a fast solution for counting files when combined with wc -l
e.g.

fd . --extension json ~/projects/ | wc -l
1268

Would it be possible to add an item count feature?
i.e. output a count of items, rather than a list of items.
e.g.

fd . --extension json --count ~/projects/
1268

Having a count feature in fd would remove the need to pipe from fd to wc, which is desirable if fd is called from another program and you wish to avoid running fd and wc in a shell session.

@solonovamax
Copy link

I would also find this feature useful

it would be most useful when counting a huge number of files. There's a cost incurred from printing file names to stdout, and this would avoid that cost entirely.

since fd is threaded, each thread can count their own totals, then you just add up all the totals at the end.

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

No branches or pull requests

2 participants