# fcnt ![Crates.io](https://img.shields.io/crates/v/fcnt?color=9cf) ![Crates.io](https://img.shields.io/crates/d/fcnt?color=green&label=install) **fcnt** is a file counter used in command line. It can quickly count the number and size of huge amount of files in multiple directories through multi-threading. ## Usage ```shell $ fcnt [OPTIONS] [DIRECTORIES]... ``` - Arguments: [DIRECTORIES]... The directories (default: ./) - Options: ``` -a Count all regular and hidden files -d Count the number of directories -o The value to sort the results. Possible values: [n]ame, [f]ile, [d]ir, [s]ize. -r Match entries using regex (only matche filenames) -R Non-recursive mode (files in sub-directories will be ignored) -s Count the total size of files -t The number of threads for traversal (invalid in `non_recursive` mode) -T The number of threads for traversal (invalid in `non_recursive` mode) -v Verbose mode, open this option will display the found entries -h, --help Print help (see more with '--help') -V, --version Print version ``` ## Example By default, only the number of sub-files in each directory is included in the result. ```shell fcnt ./Pictures ./Music ./src/package Path Files ./src/package 8070 ./Pictures 7799 ./Music 3455 ────────────────────────── Total 19324 ``` You can use the `-d` option to show the number of subdirectories and the `-s` option to show the size of each directory. ```shell $ fcnt -s ./Pictures ./Music ./src/package Path Files Dirs Size ./Pictures 7799 274 17.5G ./Music 3455 1196 21G ./src/package 8070 3120 4G ───────────────────────────────── Total 19324 4590 42.6G ``` The `-r` option can be used to filter files by regex and the `-o` option sorts the results in descending order on the specified column. ```shell # Count the number of ".py" files in each subdirectory of "src" and sort by files. $ fcnt -r '\.py$' -o f src/* Path Files src/codebook/ 829 src/package/ 376 src/test/ 31 src/spiderman/ 7 src/Notes/ 0 ───────────────────── Total 1243 ```