#image #5g #command-line #pictures #size #counting #numbers #tools #music #dirs

app fcnt

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

2 releases

0.2.3 Jan 30, 2023
0.2.2 Jan 18, 2023
0.2.1 Jan 8, 2023
0.2.0 Jan 6, 2023

#72 in Audio

MIT license

561 lines


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)
    -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


~86K SLoC