Post History
The obvious way to do it is: Find some way to get a list of the files Pipe it into wc to count Classically, this would be find /path/to/dir | wc. However fd does the same thing with better u...
Answer
#1: Initial revision
The obvious way to do it is: 1. Find some way to get a list of the files 2. Pipe it into `wc` to count Classically, this would be `find /path/to/dir | wc`. However `fd` does the same thing with better usability. By default, `fd` will skip "hidden" files and directories (like `.foo`) and will include both files and directories. Both behaviors can be changed by finding the appropriate CLI arguments in `man fd`. However, if you are in a hurry, there's no need to overcomplicate it: ``` fd | grep -v '/$' | wc ``` `/$` is a regex meaning "ends with `/`" and `-v` is short for `--invert-match`.