Today I want to show you a cool Python module that creates statistics from a folder structure.
Folderstats is a python module and command-line interface that creates statistics from a folder structure. It returns a Pandas dataframe from the folders and files from a selected folder.
You can install via pip:
pip install folderstats
To get statistics of a folder structure as a Pandas dataframe in Python you can type:
import folderstats df = folderstats.folderstats('your_folder_path', ignore_hidden=True) df.head()
You can run this with this command
folderstats your_folder_path/ -p -i -v -o final.csv
In this case the
-i argument makes sure that hidden files (starting with a dot like the
.git folder or
.gitignore) are ignored,
-p includes the id of files and folders and the parent ids which can be used to build a graph and finally
-v is responsible for a verbose output for some feedback while running.