This used to be more useful when I didn't realize I could just rglob('*.*'). Leaving it up so I don't break my other projects/ format_size() is still convenient.
Project description
pathcrawler
Just a file globber that also give you directory size.
Install using:
pip install pathcrawler
pathcrawler contains just three functions: crawl, get_directory_size, and format_size.
crawl takes a starting directory and returns a recursive list of pathlib.Path objects for all files in the starting directory and its sub folders.
get_directory_size takes a directory and returns the total size in bytes of the contents of the directory.
format_size takes a number (presumed to be bytes) and returns it as a string rounded to two decimal places with the appropriate unit suffix.
i.e.
>>>import pathcrawler >>> pathcrawler.format_size(132458) '132.46 kb'
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
pathcrawler-2.0.0.tar.gz
(5.4 kB
view details)
Built Distribution
File details
Details for the file pathcrawler-2.0.0.tar.gz
.
File metadata
- Download URL: pathcrawler-2.0.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 187db77967d470c11d7fe6e6bce4e48ce1bb186ca8fa6e8494bc9d2b3fb3849e |
|
MD5 | c2a2a86b4c3f7aed279bd74e14e71ed1 |
|
BLAKE2b-256 | 1b2b4db2ff90dd9847f63231ac73e58ef458c48c1c303a20b3ac292e3fd3f993 |
File details
Details for the file pathcrawler-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: pathcrawler-2.0.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17d187a217a6eaa7fc68ff5a69c21a9f250505661bbcfe52c7124a896757d142 |
|
MD5 | e1202ac92eb3d3f7f16b13db12e046ef |
|
BLAKE2b-256 | 0bcfb8fd7369898f5aa4d99699165ce72f0cbd28d1c3152b20eae2b9345d72d4 |