Copy Folder Structure
A VS Code extension that generates a tree-style ASCII representation of folder structures and copies it to your clipboard.
Features
- Right-click any folder in the Explorer to copy its structure
- Generates clean, tree-style ASCII output similar to the UNIX
tree command
- Automatically ignores common build artifacts and dependencies
- One-click operation with clipboard integration
Usage
- Right-click any folder in the VS Code Explorer
- Select "Copy Folder Structure" from the context menu
- Paste the result anywhere you need it
Example Output
Default Output
.
├─ src
│ ├─ components
│ │ ├─ Button.tsx
│ │ └─ Input.tsx
│ ├─ utils
│ │ └─ format.ts
│ └─ index.ts
├─ tests
│ └─ unit.test.ts
├─ node_modules (excluded)
└─ package.json
With Excluded Folders Hidden
If you set showExcludedFolders to false, excluded folders won't appear at all.
Configuration
You can customize which folders to exclude and how they appear. Open VS Code settings (Cmd+, on Mac, Ctrl+, on Windows/Linux) and search for "Copy Folder Structure".
Available Settings
copyFolderStructure.excludePatterns
Array of folder/file names to exclude from the tree.
Default:
[
"node_modules",
".git",
"dist",
"build",
"out",
".vscode",
".DS_Store",
"coverage",
".cache"
]
Example: To also exclude android and ios folders:
"copyFolderStructure.excludePatterns": [
"node_modules",
".git",
"dist",
"build",
"out",
".vscode",
".DS_Store",
"coverage",
".cache",
"android",
"ios"
]
copyFolderStructure.showExcludedFolders
Show excluded folders with a marker instead of hiding them completely.
Type: boolean
Default: true
Example:
"copyFolderStructure.showExcludedFolders": false
copyFolderStructure.excludedFolderMarker
Text to append to excluded folder names (only used when showExcludedFolders is true).
Type: string
Default: " (excluded)"
Options:
" (excluded)"
"..."
" [excluded]"
" - excluded"
Example:
"copyFolderStructure.excludedFolderMarker": "..."
This would show: android... instead of android (excluded)
Common Use Cases
React Native Projects
To exclude large native folders:
"copyFolderStructure.excludePatterns": [
"node_modules",
".git",
"dist",
"build",
"out",
".vscode",
".DS_Store",
"coverage",
".cache",
"android",
"ios"
]
Hide Excluded Folders Completely
To make the output cleaner by not showing excluded folders at all:
"copyFolderStructure.showExcludedFolders": false
Change the Marker Style
To use a more compact marker:
"copyFolderStructure.excludedFolderMarker": "..."
Output: android... instead of android (excluded)
Installation
From VSIX (Local Installation)
- Download the
.vsix file
- Open VS Code
- Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
- Click the "..." menu at the top
- Select "Install from VSIX..."
- Choose the downloaded file
From Marketplace (When Published)
Search for "Copy Folder Structure" in the VS Code Extensions marketplace.
Development
Setup
npm install
Build
npm run compile
Watch Mode
npm run watch
Testing
- Open this project in VS Code
- Press F5 to launch the Extension Development Host
- In the new window, open a folder with subfolders
- Right-click a folder and select "Copy Folder Structure"
- Verify the tree structure is copied to your clipboard
Package
npm run package
This creates a .vsix file that can be installed locally or published to the marketplace.
Requirements
Known Issues
None at this time. Please report issues on the GitHub repository.
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.