Skip to main content

Recursively count files per directory.

Project description

countfiles

Like tree on Linux, but for number of files.

Installation

pip install countfiles2

(The package name countfiles was taken.)

The basics

$ countfiles --help
usage: countfiles [-h] [--max-depth MAX_DEPTH] [--min-filecount MIN_FILECOUNT] [--sizes] [--count-dirs] [--reverse] [--no-color] [--no-hidden] [--version] [--symlinks] [--sort-count | --sort-size] [path]

Show accumulated number of files per directory.

positional arguments:
  path

options:
  -h, --help            show this help message and exit
  --max-depth MAX_DEPTH, -d MAX_DEPTH
                        Iterate all the way, but only show directories down to this depth.
  --min-filecount MIN_FILECOUNT, -m MIN_FILECOUNT
                        Iterate all the way, but only show directories with this number of files or more.
  --sizes, -s           Also show the total size of every directory.
  --count-dirs, -c      Also include directories in the file counts.
  --reverse, -r         Reverse result sorting.
  --no-color
  --no-hidden           Ignore hidden files and folders.
  --version, -V         show program's version number and exit
  --symlinks, -ln       Follow symlinks (will throw exception if an infinite recursion is detected).
  --sort-count, -sc     Sort results by file count.
  --sort-size, -ss      Sort results by total size.

Example output

$ countfiles --sizes --max-depth 4
[  5498]  countfiles                                         [  73.8M]
├───[    27]  .git                                           [  58.7K]   ├───[     0]  branches                                   [      0]   ├───[    13]  hooks                                      [    23K]   ├───[     1]  info                                       [    240]   ├───[     3]  logs                                       [    537]      └───[     2]  refs (3 children not shown)            [    358]   ├───[     2]  objects                                    [  33.5K]      ├───[     0]  info                                   [      0]      └───[     2]  pack                                   [  33.5K]   └───[     2]  refs                                       [     73]       ├───[     1]  heads                                  [     41]       ├───[     1]  remotes (1 child not shown)            [     32]       └───[     0]  tags                                   [      0]
├───[   121]  .mypy_cache                                    [   7.8M]   └───[   119]  3.11                                       [   7.8M]       ├───[     4]  _typeshed                              [   132K]       ├───[     4]  collections                            [ 818.3K]       ├───[     6]  countfiles                             [  44.2K]       ├───[     2]  curses                                 [    38K]       ├───[    16]  email                                  [ 313.4K]       ├───[    18]  importlib (2 children not shown)       [ 339.6K]       ├───[     4]  os                                     [ 412.6K]       ├───[     2]  sys                                    [ 157.1K]       └───[     2]  zipfile                                [ 100.9K]
├───[  5329]  .venv                                          [  65.9M]   ├───[    15]  bin                                        [  19.6M]   ├───[     0]  include                                    [      0]      └───[     0]  python3.11                             [      0]   ├───[  5312]  lib                                        [  46.3M]      └───[  5312]  python3.11 (596 children not shown)    [  46.3M]   └───[     1]  share                                      [     2K]       └───[     1]  man (1 child not shown)                [     2K]
├───[     3]  build                                          [     7K]   ├───[     0]  bdist.linux-x86_64                         [      0]   └───[     3]  lib                                        [     7K]       └───[     3]  countfiles                             [     7K]
└───[    12]  src                                            [  40.2K]
    ├───[     6]  countfiles                                 [  35.3K]
       └───[     3]  __pycache__                            [  23.1K]
    └───[     6]  countfiles2.egg-info                       [   4.9K]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

countfiles2-0.6.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

countfiles2-0.6.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file countfiles2-0.6.0.tar.gz.

File metadata

  • Download URL: countfiles2-0.6.0.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.2

File hashes

Hashes for countfiles2-0.6.0.tar.gz
Algorithm Hash digest
SHA256 ccc2082c6b019d4a9c4294fc0e12709f54a5f7db95edac6397e3375c6423f2cf
MD5 d43ec762db67d01fbb572180ea084abb
BLAKE2b-256 efe734ac02a2fccb767c04cfd5d3275b80ce1ab244b9121c1073dc20f74aaf08

See more details on using hashes here.

File details

Details for the file countfiles2-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: countfiles2-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.2

File hashes

Hashes for countfiles2-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bac1d9bb97d10f4879151efdf21e1d907aaf4cd4612788c391c032c7bf1a8080
MD5 560dfe9cce16fe5c12a391b8eb6d2a62
BLAKE2b-256 d145495337e1f05e46301a935ce915d0e38be916175525a091cb3c29795d84b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page