Crates.io | fcnt |
lib.rs | fcnt |
version | 0.2.8 |
source | src |
created_at | 2023-01-06 14:51:34.271426 |
updated_at | 2024-10-24 03:48:56.139005 |
description | fcnt is a cmd-line tool for counting the number of files in given directories. |
homepage | https://github.com/seamile/fcnt |
repository | https://github.com/seamile/fcnt |
max_upload_size | |
id | 752333 |
size | 41,694 |
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.
$ fcnt [OPTIONS] [DIRECTORIES]...
Arguments:
[DIRECTORIES]... The directories (default: ./)
Options:
-a Count all regular and hidden files
-d Count the number of directories
-o <ORDER_BY> The value to sort the results. Possible values: [n]ame, [f]ile, [d]ir, [s]ize.
-r <PATTERN> 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 <TOP> The number of threads for traversal (invalid in `non_recursive` mode)
-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
-h, --help Print help (see more with '--help')
-V, --version Print version
By default, only the number of sub-files in each directory is included in the result.
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.
$ 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.
# 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