Treewalker
A simple package to walk a directory tree and collect files and sizes into a SQLite DB.
Usage
For simple (and most) use cases, simply install the package from PyPI:
pip install treewalker
And run it from the command line:
treewalker --help
treewalker --db test.sqlite --walk C:/temp
This is the preferred and recommended way to run Treewalker.
Usage and development
Get started (change directory to where you want the project first):
pip install treewalker
Run the script with your own .json configuration:
python treewalker.py --cfg my_config.json
{
"database": "test.sqlite",
"walk": "c:/temp"
}
Or run the script entirely from the command line:
python treewalker.py --db test.sqlite --walk c:\temp
Or build a single file executable if you need this to run on Windows systems that won't have Python pre-installed:
scripts/build_pyinstaller.bat c:/target/folder
scripts/build_pyinstaller_xp.bat c:/target/folder
This creates a treewalker.exe, which can be run 'anywhere':
.\treewalker.exe --db test.sqlite --walk c:\temp
Note that the executable will be limited to running on systems that support the version of Python you're using to build it. I.e. for Windows XP (32-bit or 64-bit), the very latest version of Python you can use is 3.4.4.
Getting at the data
You can easily access the contents of any of the sqlite files:
from sqlite3 import connect
conn = connect('test.sqlite')
c = conn.cursor()
# show all the root directories
print(c.execute('SELECT * FROM dirs WHERE parent_dir<0').fetchall())
# show all files that have "test" in their name (case-insensitive)
print(c.execute('SELECT * FROM files WHERE name LIKE "%test%"').fetchall())
Look at the documentation of the Python standard sqlite3 library for more examples. https://docs.python.org/3/library/sqlite3.html and at the documentation of Treewalker at https://treewalker.readthedocs.io
Metadata
Release files for treewalker 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| treewalker-0.2.2.tar.gz | 13.9 kB | Without provenance | Details |
Release files / treewalker-0.2.2.tar.gz
| Download URL | treewalker-0.2.2.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1beb2909220f273dd466a6d0322376e78c9cf9cf3def1cb3ab6ea70b693f9f8f
|
|
BLAKE2b-256 checksum How to use checksums |
d46e0ed9264d1eb31e0958d244d33756d6c0908f1052dd2385165eaeac412973
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Security for treewalker 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.