Skip to main content

Fast File Count: Recursively count files and directories very quickly

Project description

Fast File Count in Python

build PyPI version Python package downloads

This is a Python package to quickly count the number of files and directories in a given path. Optionally you can count recursively and include hidden files in the total.

This package is a wrapper around fast-file-count by Christopher Schultz . Credit for the initial version belongs to Christopher Schultz, I wrote the Python wrapper, converted the Windows code to use builtin functionality, and packaged it up. See the file src/c_count.c for the other contributors and see the commit history of this package on GitHub for my exact changes.

Installation

Installation can be done easily with pip:

$ pip install ffcount

Usage

There is a command line application called ffcount, which recursively counts files and directories:

$ ffcount

See ffcount -h for options.

The package can also be used as a Python library, using the ffcount function. This function returns a tuple (number_of_files, number_of_dirs) and it can be used as follows:

>>> from ffcount import ffcount

# count everything under the current path
>>> ffcount()
(521013, 43012)

# count without hidden files
>>> ffcount(hidden=False)
(234012, 12082)

# use a different path
>>> ffcount('/tmp')
(81, 10)

Note that ffcount counts links as files, even if they point to a directory. In some cases, this explains the discrepancy with other ways of counting.

To obtain the full function documentation, simply run:

>>> import ffcount
>>> help(ffcount)

License

The original C code by Christopher Schultz was licensed under the Apache License 2.0. This package is therefore licensed under this license as well.

Project details


Download files

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

Files for ffcount, version 0.1.9
Filename, size File type Python version Upload date Hashes
Filename, size ffcount-0.1.9-cp36-cp36m-macosx_10_9_x86_64.whl (18.0 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size ffcount-0.1.9-cp36-cp36m-manylinux1_i686.whl (56.1 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size ffcount-0.1.9-cp36-cp36m-manylinux1_x86_64.whl (57.4 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size ffcount-0.1.9-cp36-cp36m-manylinux2010_i686.whl (56.1 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size ffcount-0.1.9-cp36-cp36m-manylinux2010_x86_64.whl (57.4 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size ffcount-0.1.9-cp36-cp36m-win32.whl (19.9 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size ffcount-0.1.9-cp36-cp36m-win_amd64.whl (21.7 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size ffcount-0.1.9-cp37-cp37m-macosx_10_9_x86_64.whl (18.0 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size ffcount-0.1.9-cp37-cp37m-manylinux1_i686.whl (57.1 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size ffcount-0.1.9-cp37-cp37m-manylinux1_x86_64.whl (58.4 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size ffcount-0.1.9-cp37-cp37m-manylinux2010_i686.whl (57.1 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size ffcount-0.1.9-cp37-cp37m-manylinux2010_x86_64.whl (58.4 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size ffcount-0.1.9-cp37-cp37m-win32.whl (20.0 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size ffcount-0.1.9-cp37-cp37m-win_amd64.whl (21.8 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size ffcount-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl (18.1 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size ffcount-0.1.9-cp38-cp38-manylinux1_i686.whl (58.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size ffcount-0.1.9-cp38-cp38-manylinux1_x86_64.whl (59.6 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size ffcount-0.1.9-cp38-cp38-manylinux2010_i686.whl (58.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size ffcount-0.1.9-cp38-cp38-manylinux2010_x86_64.whl (59.6 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size ffcount-0.1.9-cp38-cp38-win32.whl (20.1 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size ffcount-0.1.9-cp38-cp38-win_amd64.whl (21.9 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size ffcount-0.1.9-cp39-cp39-macosx_10_9_x86_64.whl (18.1 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size ffcount-0.1.9-cp39-cp39-manylinux1_i686.whl (58.2 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size ffcount-0.1.9-cp39-cp39-manylinux1_x86_64.whl (59.3 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size ffcount-0.1.9-cp39-cp39-manylinux2010_i686.whl (58.2 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size ffcount-0.1.9-cp39-cp39-manylinux2010_x86_64.whl (59.3 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size ffcount-0.1.9-cp39-cp39-win32.whl (20.2 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size ffcount-0.1.9-cp39-cp39-win_amd64.whl (21.9 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size ffcount-0.1.9.tar.gz (35.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page