Structure to Files and Folders
A VS Code extension that converts text-based folder structures into actual files and folders in your workspace.
Features
- Quick Structure Generation: Paste any text-based folder structure and instantly create the corresponding files and folders
- Smart Parsing: Automatically detects files vs folders based on file extensions and trailing slashes
- Tree Format Support: Works with various tree structure formats including those with tree characters (
├
, └
, │
, ─
)
- Comment Filtering: Ignores comments (lines starting with
#
) in your structure input
- Workspace Integration: Creates structure directly in your current workspace folder
Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Structure to Files and Folders"
- Click Install
Usage
- Open a workspace folder in VS Code (the extension requires an active workspace)
- Open Command Palette (
Ctrl+Shift+P
/ Cmd+Shift+P
)
- Run the command: Type "Create Structure" and select
Structure to Files and Folders: Create Structure
- Paste your structure: Enter your folder/file structure in the input box
- Generate: Press Enter to create the structure in your workspace
The extension supports various text-based folder structure formats:
src/
components/
Header.js
Footer.js
utils/
helpers.js
public/
index.html
style.css
package.json
README.md
├── src/
│ ├── components/
│ │ ├── Header.js
│ │ └── Footer.js
│ └── utils/
│ └── helpers.js
├── public/
│ ├── index.html
│ └── style.css
├── package.json
└── README.md
src/
components/ # React components
Header.js
Footer.js
utils/ # Utility functions
helpers.js
public/ # Static assets
index.html
style.css
package.json # Dependencies
README.md # Documentation
How It Works
The extension intelligently parses your input structure:
- Folders: Identified by trailing slashes (
/
) or lack of file extensions
- Files: Identified by file extensions (e.g.,
.js
, .html
, .css
)
- Indentation: Uses spaces and tree characters to determine nesting levels
- Comments: Lines starting with
#
are ignored
- Empty Files: Creates empty files that you can populate later
Requirements
- VS Code 1.74.0 or higher
- An open workspace folder
Commands
Command |
Description |
Structure to Files and Folders: Create Structure |
Opens input dialog to create folder/file structure |
Error Handling
The extension includes robust error handling:
- No Workspace: Shows error if no workspace folder is open
- Empty Input: Validates that input is not empty
- File System Errors: Catches and displays any file creation errors
- Invalid Format: Gracefully handles malformed structure input
Examples
React Project Structure
my-react-app/
src/
components/
App.js
Header.js
Sidebar.js
hooks/
useApi.js
useAuth.js
pages/
Home.js
About.js
styles/
App.css
globals.css
public/
index.html
favicon.ico
package.json
README.md
Node.js API Structure
api/
controllers/
userController.js
authController.js
middleware/
auth.js
validation.js
models/
User.js
Post.js
routes/
users.js
auth.js
config/
database.js
server.js
package.json
.env
server.js
Tips
- Use consistent indentation (spaces or tabs) for best results
- Add trailing slashes to folder names to ensure they're recognized as directories
- Include file extensions to ensure items are created as files, not folders
- Test with small structures first to verify the format works as expected
Contributing
Found a bug or have a feature request? Please open an issue on our GitHub repository.
License
This extension is licensed under the MIT License. See the LICENSE file for details.
Release Notes
1.0.0
- Initial release
- Basic structure generation from text input
- Support for various tree formats
- Comment filtering
- Workspace integration
Enjoy creating your project structures with ease! 🚀