Skip to content

Prashant-zHere/Tree2FS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tree2FS

Tree2FS is a simple Python tool that reads a .txt file describing a project directory structure and automatically creates the corresponding folders and files on your system.

Perfect for quickly scaffolding new projects, replicating existing structures, or setting up development environments from documentation.

Features

  • πŸ—οΈ Create complete directory structures from text files
  • πŸ“ Supports nested folders and files
  • πŸ”§ Works on Linux, macOS, and Windows
  • πŸ“„ Creates empty files as placeholders
  • 🎯 Simple, lightweight, and easy to use
  • βœ… Handles tree-style formatting with box drawing characters

Installation

No installation required! Just download structure.py and run it with Python 3.

git clone <repository-url>
cd tree2fs

Usage

  1. Create a text file with your desired directory structure
  2. Run the script:
python structure.py
  1. Enter the path to your structure file when prompted
  2. The tool will create the directory structure in the current directory

Input File Format

The text file should describe your project structure using tree-style formatting:

  • Folders should end with /
  • Files should have proper extensions (.py, .js, .md, etc.)
  • Use tree characters (β”œβ”€β”€, └──, β”‚) for visual structure

Example Structure File

my_project/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── helpers.py
β”‚   └── config.json
β”œβ”€β”€ tests/
β”‚   └── test_main.py
β”œβ”€β”€ docs/
β”‚   └── README.md
└── requirements.txt

This will create:

my_project/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py (empty file)
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── helpers.py (empty file)
β”‚   └── config.json (empty file)
β”œβ”€β”€ tests/
β”‚   └── test_main.py (empty file)
β”œβ”€β”€ docs/
β”‚   └── README.md (empty file)
└── requirements.txt (empty file)

How It Works

  1. Parses the input file line by line
  2. Analyzes indentation levels using tree characters
  3. Creates directories for items ending with /
  4. Creates empty files for items with extensions
  5. Maintains the hierarchical structure using a path stack

Requirements

  • Python 3.x
  • No external dependencies

Contributing

Feel free to submit issues, feature requests, or pull requests to improve Tree2FS!

About

πŸ“‚ Python tool to generate project folders and files from a .txt template ⚑ Automate project scaffolding quickly and easily

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages