treewalker


Nametreewalker JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://gitlab.com/bmt-aus/tool/treewalker.git
SummaryA simple package to walk a directory tree and collect files and sizes into a SQLite DB.
upload_time2025-07-25 06:07:57
maintainerNone
docs_urlNone
authorBMT Commercial Australia Pty Ltd, Jaap van der Velde
requires_pythonNone
licenseMIT
keywords system tool database
VCS
bugtrack_url
requirements conffu scandir typing mkdocs
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:
```commandline
pip install treewalker
```
And run it from the command line:
```commandline
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):
```commandline
pip install treewalker
```

Run the script with your own .json configuration:
```commandline
python treewalker.py --cfg my_config.json
```

```my_config.json
{
    "database": "test.sqlite",
    "walk": "c:/temp"
}
```

Or run the script entirely from the command line:
```commandline
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:
```commandline
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':
```commandline
.\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:
```python
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

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/bmt-aus/tool/treewalker.git",
    "name": "treewalker",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "system, tool, database",
    "author": "BMT Commercial Australia Pty Ltd, Jaap van der Velde",
    "author_email": "jaap.vandervelde@bmtglobal.com",
    "download_url": "https://files.pythonhosted.org/packages/e4/75/f1244e516b814256bfcbe73bb680c53a817296e28563b14c8a9d4d6be7a3/treewalker-0.2.1.tar.gz",
    "platform": null,
    "description": "# Treewalker\r\n\r\nA simple package to walk a directory tree and collect files and sizes into a SQLite DB.\r\n\r\n## Usage\r\n\r\nFor simple (and most) use cases, simply install the package from PyPI:\r\n```commandline\r\npip install treewalker\r\n```\r\nAnd run it from the command line:\r\n```commandline\r\ntreewalker --help\r\ntreewalker --db test.sqlite --walk C:/temp\r\n```\r\nThis is the preferred and recommended way to run Treewalker.\r\n\r\n## Usage and development\r\n\r\nGet started (change directory to where you want the project first):\r\n```commandline\r\npip install treewalker\r\n```\r\n\r\nRun the script with your own .json configuration:\r\n```commandline\r\npython treewalker.py --cfg my_config.json\r\n```\r\n\r\n```my_config.json\r\n{\r\n    \"database\": \"test.sqlite\",\r\n    \"walk\": \"c:/temp\"\r\n}\r\n```\r\n\r\nOr run the script entirely from the command line:\r\n```commandline\r\npython treewalker.py --db test.sqlite --walk c:\\temp\r\n```\r\n\r\nOr build a single file executable if you need this to run on Windows systems that won't have Python pre-installed:\r\n```commandline\r\nscripts/build_pyinstaller.bat c:/target/folder\r\nscripts/build_pyinstaller_xp.bat c:/target/folder\r\n\r\n```\r\nThis creates a `treewalker.exe`, which can be run 'anywhere':\r\n```commandline\r\n.\\treewalker.exe --db test.sqlite --walk c:\\temp\r\n```\r\n\r\nNote 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.\r\n\r\n## Getting at the data\r\n\r\nYou can easily access the contents of any of the sqlite files:\r\n```python\r\nfrom sqlite3 import connect\r\n\r\nconn = connect('test.sqlite')\r\nc = conn.cursor()\r\n# show all the root directories\r\nprint(c.execute('SELECT * FROM dirs WHERE parent_dir<0').fetchall())\r\n# show all files that have \"test\" in their name (case-insensitive)\r\nprint(c.execute('SELECT * FROM files WHERE name LIKE \"%test%\"').fetchall())\r\n```\r\nLook 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\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple package to walk a directory tree and collect files and sizes into a SQLite DB.",
    "version": "0.2.1",
    "project_urls": {
        "Documentation": "https://treewalker.readthedocs.io/",
        "Home page": "https://pypi.org/project/treewalker",
        "Homepage": "https://gitlab.com/bmt-aus/tool/treewalker.git",
        "Source Code": "https://github.com/jaapvandervelde/treewalker"
    },
    "split_keywords": [
        "system",
        " tool",
        " database"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e475f1244e516b814256bfcbe73bb680c53a817296e28563b14c8a9d4d6be7a3",
                "md5": "711d6611a9ea3a614606ac7c9391390a",
                "sha256": "8d2375f52946e6d2fb5f3fec4aa388c00fcb11a5dda15d3381a6a34ec8433cc0"
            },
            "downloads": -1,
            "filename": "treewalker-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "711d6611a9ea3a614606ac7c9391390a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13767,
            "upload_time": "2025-07-25T06:07:57",
            "upload_time_iso_8601": "2025-07-25T06:07:57.735145Z",
            "url": "https://files.pythonhosted.org/packages/e4/75/f1244e516b814256bfcbe73bb680c53a817296e28563b14c8a9d4d6be7a3/treewalker-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 06:07:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jaapvandervelde",
    "github_project": "treewalker",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "conffu",
            "specs": [
                [
                    ">=",
                    "2.2.16"
                ]
            ]
        },
        {
            "name": "scandir",
            "specs": []
        },
        {
            "name": "typing",
            "specs": []
        },
        {
            "name": "mkdocs",
            "specs": []
        }
    ],
    "lcname": "treewalker"
}
        
Elapsed time: 1.42641s