Skip to main content

Folder Structure Generator

Generate clean Markdown folder trees for project documentation, README files, onboarding notes, and issue reports.

my-project/
|-- docs/
|   `-- index.md
|-- src/
|   `-- app.py
`-- README.md

Why use it?

  • Simple Python API for generating project trees.
  • Command-line interface for quick copy-and-paste output.
  • Deterministic, sorted output for cleaner documentation diffs.
  • Built-in ignores for common noise like .git, __pycache__, venv, dist, and node_modules.
  • No runtime dependencies.

Installation

pip install folder-structure-generator

For local development:

git clone https://github.com/ujjawalpoudel/folder-structure-generator.git
cd folder-structure-generator
python3 -m pip install -e .

Command-Line Usage

Generate a tree for the current directory:

folder-structure

Generate a tree for a specific project:

folder-structure path/to/project

Write the output to a file:

folder-structure path/to/project --output STRUCTURE.md

Useful options:

folder-structure --directories-only
folder-structure --exclude-hidden
folder-structure --max-depth 2
folder-structure --ignore migrations --ignore generated
folder-structure --no-default-ignore

The package also exposes folder-structure-generator as an alias command.

Python Usage

from folder_structure import FolderStructureGenerator

generator = FolderStructureGenerator(
    ignored_folders=[".git", "__pycache__", "node_modules"],
    max_depth=3,
)

tree = generator.generate("path/to/project")
print(tree)

You can also keep using the original method name:

tree = generator.generate_folder_structure_md("path/to/project")

API

FolderStructureGenerator(...)

Options:

  • ignored_folders: folder names or relative paths to exclude.
  • include_files: include files in the generated tree. Defaults to True.
  • include_hidden: include dotfiles and hidden directories. Defaults to True.
  • max_depth: maximum folder depth below the root. Defaults to no limit.

generate(path=None)

Returns a Markdown-friendly tree for path. If path is not provided, it scans the current working directory.

Development

Run the test suite:

python3 -m unittest discover -s tests

Build the package:

python3 -m pip install build
python3 -m build

Contributing

Ideas, issues, and pull requests are welcome. Good first improvements include output format options, richer ignore patterns, and documentation examples for common project types.

See CONTRIBUTING.md for local setup, test commands, and release notes.

Repository: https://github.com/ujjawalpoudel/folder-structure-generator

Changelog

See CHANGELOG.md for release history.

License

Licensed under the Apache License 2.0. See LICENSE.

Metadata

Release files for folder-structure-generator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for folder-structure-generator 0.1.0
File Size Uploaded
folder_structure_generator-0.1.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for folder-structure-generator 0.1.0
File Interpreter ABI Platform
folder_structure_generator-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / folder_structure_generator-0.1.0.tar.gz

Download URL folder_structure_generator-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
02fcb4d1bab372d4d0f9ee7470e3ef441f161332382ef456dca9eb1d538f4241
BLAKE2b-256 checksum
How to use checksums
bce262b9deed050137e2ae0452e5024043b7e4d06c31166cc56f7274e1b61a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / folder_structure_generator-0.1.0-py3-none-any.whl

Download URL folder_structure_generator-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5424be79ec5bb480a1ef0ff1d30cc595a94d3c106af929b56c952a9ba928d245
BLAKE2b-256 checksum
How to use checksums
9107b094fa1ec422a87656299cb3d0e6b4cb5775ac17c8ae79244a152c50794a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page