Skip to content

Chikine/Folder-Structure-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

StructTool

StructTool is a command-line tool that saves and recreates folder structures.

It can be used as a lightweight project template manager, allowing you to:

  • Save folder structures
  • Recreate structures later
  • Store multiple versions
  • Save file contents (optional)
  • Organize templates using tags
  • Search templates by tag
  • Display structure trees
  • Store templates as JSON or TXT

Table of Contents

Features

✅ Save folder structures

✅ Recreate structures

✅ JSON and TXT formats

✅ Optional file content storage

✅ Structure versioning

✅ Tags and categories

✅ Search by tag

✅ Tree visualization

✅ Ignore files and folders

✅ Cross-platform support


Quick Start

# Initialize configuration files
structtool init

# Save a structure
structtool save website .

# Show saved structures
structtool list

# Recreate a structure
structtool load website ./NewProject

Quick Usage

StructTool can be invoked using either:

  • structtool (full command)
  • strt (short alias)

Examples:

structtool init
strt init

structtool save website .
strt save website .

Installation

Clone the repository:

git clone https://github.com/Chikine/Folder-Structure-Tool

cd structtool

Install locally:

pip install .

Verify installation:

structtool --help

Initialize a Project

Before saving structures, initialize StructTool in your project:

structtool init

This creates two configuration files:

.structignore
.structtool.json

.structignore

Defines files and folders that should not be saved.

Example:

# Node.js
node_modules
dist

# Python
__pycache__
*.pyc

# Git
.git

# IDE
.vscode
.idea

These patterns are automatically applied when running:

structtool save website .

.structtool.json

Stores default StructTool settings.

Example:

{
    "default_format": "json",
    "include_content": false,
    "ignore_file": ".structignore",
    "default_tags": [],
    "max_content_size_kb": 100
}

This allows structtool save to reuse project settings without repeatedly specifying command-line options.


Recreate Configuration Files

If configuration files already exist, StructTool will preserve them:

structtool init

To overwrite existing files:

structtool init --force

Recommended Workflow

# Initialize configuration
structtool init

# Save the current project
structtool save website .

# Show available structures
structtool list

# Load the structure elsewhere
structtool load website ./NewProject

Commands

Save a Structure

Save a folder structure:

structtool save website .

Save as JSON

structtool save website . --format json

Save as TXT

structtool save website . --format txt

Save File Contents

By default only folder/file names are stored.

To save file contents:

structtool save website . --include-content

Example:

structtool save react-app . \
    --format json \
    --include-content

Ignore Files and Folders

Ignore specific paths while saving:

structtool save website . \
    --ignore node_modules .git dist

Example:

structtool save website . \
    --ignore node_modules .git __pycache__

Add Tags

Attach tags to structures:

structtool save react-app . \
    --tags react frontend vite

Metadata example:

{
    "name": "react-app",
    "tags": [
        "react",
        "frontend",
        "vite"
    ],
    "latest_version": 1
}

Load a Structure

Load the latest version of a structure:

structtool load website ./NewProject

Result:

NewProject/
├── src/
├── public/
└── package.json

List Structures

Display all saved structures:

structtool list

Example:

react-app
website
api-server

Remove a Structure

Delete a structure and all versions:

structtool remove website

Show Version History

Display saved versions:

structtool history website

Example:

v1.json
v2.json
v3.json

Search by Tag

Search structures using tags:

structtool search react

Example:

react-app
react-dashboard
react-admin

Tree View

Display a saved structure:

structtool show website

Example:

src
├── components
├── pages
├── App.jsx
└── main.jsx

public
└── favicon.ico

Versioning

Each save creates a new version automatically.

Example:

structtool save website .

Creates:

v1.json

Saving again:

structtool save website .

Creates:

v2.json

Saving again:

structtool save website .

Creates:

v3.json

Latest version is automatically used when loading.


Storage Location

Windows

C:\Users\<username>\.structtool\structures

Linux

~/.structtool/structures

macOS

~/.structtool/structures

Structure Layout

Example:

.structtool/
└── structures/
    └── website/
        ├── metadata.json
        ├── v1.json
        ├── v2.json
        └── v3.txt

Metadata:

{
    "name": "website",
    "tags": [
        "frontend",
        "react"
    ],
    "latest_version": 3
}

JSON Structure Format

Example:

{
    "format": "json",
    "include_content": true,
    "items": [
        {
            "type": "dir",
            "path": "src"
        },
        {
            "type": "file",
            "path": "src/App.jsx",
            "content": "export default function App() {}"
        }
    ]
}

Roadmap

Planned features:

  • Export structures
  • Import structures
  • Structure diff
  • Structure validation
  • Remote template repositories
  • .structignore support
  • Interactive project wizard
  • Better tree rendering

Development

Run from source:

python -m structtool.cli

Install editable version:

pip install -e .

Command Table

Command Description
structtool init Create .structignore and .structtool.json
structtool save Save a folder structure
structtool load Recreate a structure
structtool list Show saved structures
structtool history Show version history
structtool show Display structure tree
structtool search Search by tags
structtool remove Delete a structure

License

MIT License

About

A tool that helps you to save and load folder structure

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages