semvec/pypi-packages huggingface dataset:
pathcrawler 2.0.0
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.
Requires Python: >=3.10
Keywords: directory

# pathcrawler
Just a file globber that also give you directory size.<br>
Install using:
<pre>pip install pathcrawler</pre>
<br>
pathcrawler contains just three functions: crawl, get_directory_size, and format_size.<br>
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.<br>
get_directory_size takes a directory and returns the total size in bytes of the contents of the directory.<br>
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.<br>
i.e. 
<pre>
>>>import pathcrawler
>>> pathcrawler.format_size(132458)
'132.46 kb'
</pre>