Command-line utility that lists blobs in Azure Blob Storage containers whose names end with a given file type (extension), and reports the total size of matching files.
- Scan one or more containers in a storage account
- Filter blobs by filename suffix (e.g.
.pdf) - Print per-blob sizes and a total size summary
- Credentials via CLI flags or environment variables (keys are never printed)
- Python 3.12 or newer
- An Azure Storage account with access to the target containers
git clone https://github.com/hippi345/GetBlobsOfFileTypePython.git
cd GetBlobsOfFileTypePython
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"Copy .env.example to .env for local reference (do not commit .env).
| Variable | Description |
|---|---|
AZURE_STORAGE_ACCOUNT_NAME |
Storage account name (used with account key) |
AZURE_STORAGE_ACCOUNT_KEY |
Storage account key |
AZURE_STORAGE_CONNECTION_STRING |
Full connection string (optional; takes precedence when set) |
CLI flags -s / -k override environment variables for account name and key when not using a connection string.
python main.py -s myaccount -k "$AZURE_STORAGE_ACCOUNT_KEY" -c container1 container2 -f .pdfOr with environment variables:
export AZURE_STORAGE_ACCOUNT_NAME=myaccount
export AZURE_STORAGE_ACCOUNT_KEY='...'
python main.py -c logs backups -f .jsonExample output:
Welcome to the storage utility...
The containers are: ['logs', 'backups']
The Storage account is: myaccount
The key is: [redacted]
The file type for search is: .pdf
logs:
2024/report.pdf: 1024 bytes
Total size of .pdf files: 1024 bytes
Installed package entry point (optional):
get-blobs-of-file-type -c mycontainer -f .txt -s myaccount -k "$AZURE_STORAGE_ACCOUNT_KEY"Tests run offline with mocked storage clients (no Azure credentials required):
pytest
ruff check .
ruff format --check .├── get_blobs_of_file_type/ # Package: scanner + CLI
│ ├── cli.py
│ └── scanner.py
├── main.py # Backward-compatible entry point
├── tests/
├── pyproject.toml
├── .github/workflows/ci.yml
└── SECURITY.md
MIT License — Copyright (c) 2026 Joel Shearon. See LICENSE.