My Directory List & Print Extension
Two jobs, done simply:
- Folder → text. Show, copy or export any folder as a tree, list, Markdown, CSV or JSON.
- Text → folder. Turn a pasted tree or list into real folders and files, with a preview first and undo.
Folder → text
Right-click a folder in the Explorer:
| Command |
What you get |
| Show Folder Tree |
The tree in a new tab |
| Copy Folder Tree |
The tree on your clipboard |
| Export Folder List... |
Pick a format: Tree, Detailed list, Markdown, CSV, JSON |
my-site/
├── css/
│ └── main.css
├── js/
│ └── app.js
└── index.html
2 folders, 3 files, 4.1 KB
No Explorer? Run the same commands from the Command Palette (Ctrl+Shift+P, type Directory List). With one workspace folder it just uses it; with several it asks once.
Text → folder
- Select the text (a tree, an indented list, a Markdown list or one path per line) and right-click → Create Folders and Files from Text.... Or copy it and run Directory List: Create Folders and Files from Text... from the Command Palette.
- Check the preview: exactly which folders and files will be created, which already exist, and which lines were rejected.
- Press Create. Changed your mind? Directory List: Undo Last Creation.
What it understands, automatically:
tree (Linux, macOS, Windows `tree /f`, ASCII) indented / Markdown list one path per line
my-site/ - **my-site/** my-site/
├── css/ - **css/** my-site/css/main.css
│ └── main.css - main.css my-site/index.html
└── index.html - index.html
- A name ending in
/ is a folder. Otherwise an item with children is a folder, and the rest are files.
- Comments (
# ...), sizes ((1.2 KB)), -> link arrows, code fences and the "3 directories, 8 files" line are ignored.
- The preview offers Without "my-site/" folder if everything sits inside one top folder, and Change folder....
Why you can trust it
- Preview before anything is written. The same plan you see is the plan that runs.
- Never overwrites. Existing files are left exactly as they are. New files are created empty.
- Stays inside the folder you chose.
.., absolute paths, odd characters and symbolic links that lead elsewhere are rejected.
- Undo is careful. It removes only what the last run created, and only empty files and empty folders. Files you edited are kept.
- Everything is logged. Directory List: Show Log lists every item created, kept or skipped.
- Listing never follows symbolic links, skips what you ignore, and stops at a safety limit (and says so).
Settings
| Setting |
Default |
Meaning |
directoryList.ignore |
.git, node_modules, .DS_Store, Thumbs.db |
Names and patterns to leave out (*.log, dist/, src/generated) |
directoryList.includeHidden |
true |
Include names starting with a dot |
directoryList.maxDepth |
0 |
Levels to list (0 = all, 1 = just the folder's content) |
directoryList.maxEntries |
20000 |
Safety limit |
directoryList.sortBy |
name |
name, size (biggest first), date (newest first), none |
directoryList.foldersFirst |
true |
Folders before files |
directoryList.showSizes |
false |
Sizes in trees and Markdown |
directoryList.showSummary |
true |
"3 folders, 8 files" line |
directoryList.exportTo |
editor |
editor, clipboard, both or file |
directoryList.alwaysAskFolder |
false |
Ask for the folder even with one workspace folder |
directoryList.confirmBeforeCreate |
true |
Keep the preview on (recommended) |
CSV notes: values are quoted per RFC 4180, dates are ISO 8601, and a name starting with = or @ gets a leading ' so spreadsheets do not run it as a formula.
Upgrading from 1.0
All old command ids still work (keybindings and tasks keep running), but they are now hidden from the Palette and open the new flows. What changed:
- Listings are recursive (set
maxDepth to 1 for the old one-level behavior) and use a compact format instead of five lines per file.
- The sorting question is now the
sortBy setting. Fewer questions, same result.
- The ASCII parser was rewritten: it follows columns, so trees whose last branches use blank indentation,
tree /f output and 2-space/tab indentation now work. The old parser turned └── ci.yml under such a branch into a file literally named └── ci.yml, in the wrong folder.
- The top folder of a tree is now created (or skipped on request) instead of being silently dropped.
- Existing files are no longer replaced by empty ones.
فارسی
دو کار ساده:
۱. پوشه ← متن: هر پوشه را بهصورت درخت، فهرست، Markdown، CSV یا JSON نشان بدهید، کپی کنید یا خروجی بگیرید. روی پوشه در Explorer راستکلیک کنید: Show Folder Tree، Copy Folder Tree، Export Folder List....
۲. متن ← پوشه: یک درخت یا فهرست را انتخاب کنید و راستکلیک ← Create Folders and Files from Text.... (یا آن را کپی کنید و از Command Palette دستور Directory List: Create Folders and Files from Text... را بزنید.) نوع متن خودکار تشخیص داده میشود: درخت (├──)، فهرست تورفته، فهرست Markdown یا یک مسیر در هر خط.
اطمینانبخش بودن
- پیش از ساخت پیشنمایش میبینید: چه چیزی ساخته میشود، چه چیزی از قبل هست و کدام خطها رد شدهاند.
- هرگز فایل موجود را بازنویسی نمیکند. فایلهای تازه خالی ساخته میشوند.
- از پوشهٔ انتخابشده بیرون نمیرود:
..، مسیر مطلق و نامهای ناجور رد میشوند.
- بازگردانی (Undo) فقط چیزهایی را که همان بار ساخته شده حذف میکند و فایلهایی را که ویرایش کردهاید نگه میدارد.
- همهچیز در Show Log ثبت میشود.
تنظیمات (directoryList.*) در جدول بالا آمده است؛ مهمترینها ignore (چه چیزهایی نشان داده نشود)، maxDepth (چند سطح) و exportTo (ویرایشگر، کلیپبورد یا فایل) هستند.
License
MIT. See LICENSE.txt.
| |