#command-line #size #numbers #multi-threading #count #filesize #counting

app fcnt

fcnt is a cmd-line tool for counting the number of files in given directories

4 releases

0.2.7 May 3, 2024
0.2.6 Feb 25, 2024
0.2.5 Aug 8, 2023
0.2.3 Jan 30, 2023

#669 in Command line utilities

MIT license

681 lines


Crates.io Crates.io

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.


  • Arguments:

    [DIRECTORIES]... the directories (default: ./)

  • Options:

    -a                 Count all regular and hidden files
    -r <PATTERN>       Match entries using regex (only matche filenames)
    -o <ORDER_BY>      The value to sort the results by [possible values: name, n, file, f, dir, d, size, s]
    -s                 Count the total size of files
    -t <THREAD_NUM>    The number of threads for traversal (invalid in NON_RECURSIVE mode)
    -v                 Verbose mode, open this option will display the found entries
    -R                 Non-recursive mode (files in sub-directories will be ignored)
    -h, --help         Print help
    -V, --version      Print version


By default, the results will be sorted by file count in descending order.

fcnt ./Pictures ./Music ./src/package
Path           Files  Dirs
./src/package   8070  3120
./Pictures      7799   274
./Music         3455  1196
Total          19324  4590

If the -s option is specified, the sort column will be change to Size.

$ fcnt -s ./Pictures ./Music ./src/package
Path           Files  Dirs   Size
./Music         3455  1196    21G
./Pictures      7799   274  17.5G
./src/package   8070  3120     4G
Total          19324  4590  42.6G


~93K SLoC