fd icon indicating copy to clipboard operation
fd copied to clipboard

Add item count feature

Open davecoutts opened this issue 2 years ago • 1 comments

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.

davecoutts avatar Apr 02 '23 20:04 davecoutts

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.

solonovamax avatar Nov 15 '24 18:11 solonovamax