In Windows 10, redirect the Command Prompt tree output to a text file to create a printable directory tree, and add /F when files should be included.
The built-in tree command is the quickest way to inspect the folders and files under a particular directory. Its output can remain in the terminal or be saved as plain text for printing, a README, an issue report, a code review, or another document.

Print a directory tree in Windows 10 with Command Prompt
- Open Command Prompt in the parent folder. In File Explorer, navigate to the folder that contains the project or directory you want to print. Click the address bar, type cmd, and press Enter. Opening the parent gives you a convenient way to keep the saved output file outside the tree being scanned.
- Preview the hierarchy. Run tree "MyProject" to display the folders only. Add /F when the printed tree should include files as well as directories. For example, use tree "MyProject" /F. Replace MyProject with the actual folder name; quotation marks are useful when the name contains spaces.
- Choose ASCII branches when compatibility matters. The /A option replaces graphical connectors with ordinary ASCII characters. A complete preview command is tree "MyProject" /F /A. Without /A, Command Prompt can use graphic line characters instead.
- Save the output outside the scanned directory. Create an empty output folder somewhere else, such as C:\TreeOutput, and run tree "MyProject" /F /A > "C:\TreeOutput\project-tree.txt". Replace the project and destination paths with your own. Keeping the text file outside the project prevents it from becoming part of the directory being listed.
- Open and print the text file. Run notepad "C:\TreeOutput\project-tree.txt", or open it from File Explorer. In Notepad, press Ctrl+P, select the printer and page settings, preview the pages, and print. If a PDF option is available in the Windows print dialog, you can select that instead of sending the tree directly to paper.
To print the contents of the folder currently open in Command Prompt, open that folder’s parent instead and use its name in place of MyProject. The redirected file is a static snapshot: later changes to the folder do not update it automatically.
Choose between displaying, saving, and rebuilding a tree
| Goal | Workflow | Result |
|---|---|---|
| Inspect a live folder | tree "MyProject" /F /A | A terminal preview containing folders and files |
| Print or share the actual folder | Redirect tree output to a text file, then open it in Notepad | A saved plain-text representation of the Windows directory |
| Rebuild a tree from an existing path list | Directory Tree Generator | A deterministic text tree generated from relative file paths |
The source of the data is the important distinction. Command Prompt reads the selected folder, whereas Directory Tree Generator transforms paths that you supply. It cannot discover the contents of a Windows folder, confirm that a path exists, or read file contents.
Turn a relative-path list into a printable tree
- Open the Directory Tree Generator. This workflow is appropriate when you already have a list of relative file paths and need a clean tree for documentation rather than a live scan of a Windows directory.
- Prepare one complete relative file path per line. For example, use src/lib/parser.ts and src/components/Button.tsx, or use backslashes consistently throughout the list. Do not combine src/lib/parser.ts and src\components\Button.tsx in the same run.
- Choose the matching separator and tree style. Select forward slash for paths such as src/lib/parser.ts or backslash for paths such as src\lib\parser.ts. Select Unicode connectors or ASCII connectors, then choose Generate tree. Unicode uses box-drawing characters, while ASCII uses characters that are less likely to render poorly in older terminals or plain-text systems.
- Review the node count and complete output. The tree starts with a single dot representing its root. Directories appear before files at each level, and names are ordered by deterministic UTF-16 comparison rather than browser locale or filesystem metadata. Ordinary spaces, dots, and letter case remain unchanged.
- Copy the result to its destination. Use the copy control to place the tree in a README, issue, technical document, architecture note, code review, or support message. If clipboard permission is unavailable, the complete output remains visible and selectable for manual copying. Editing the input or changing a setting clears the previous result, so select Generate tree again after making a change.
Every input line represents a file, not a directory declaration. Parent directories are inferred from shared path prefixes: src/components/Button.tsx and src/index.ts produce one src directory containing a components directory and an index.ts file. A standalone src line means a file named src. Supplying both forms is therefore a file-directory conflict and is rejected.
Do not paste the raw terminal output from the tree command into this workflow. That output already contains branch characters and directory lines, while the generator expects a plain list of complete relative file paths.
Avoid paths that produce errors or misleading trees
| Problematic input | Reason | Correction |
|---|---|---|
| Mixing / and \ | Separator handling is strict and does not guess which style was intended | Convert the complete list to one separator style and select that style |
| /src/file.ts or C:\src\file.ts | Leading separators and drive-root forms are not relative paths | Remove the leading separator or drive and begin with a project-relative path |
| ., ./src/file.ts, or ../src/file.ts | Current-directory and parent-traversal segments are rejected | Express the path relative to the intended root without traversal segments |
| src//file.ts, a trailing separator, or a blank line | These create empty path segments or an invalid empty path | Remove doubled separators, trailing separators, and every blank line |
| The same path twice | Duplicate leaves are rejected rather than silently merged | Keep one complete declaration for each file path |
| src plus src/index.ts | One line declares a file while another requires it to be a directory | Remove the standalone file declaration and retain the child file paths |
A bare carriage return or another ASCII control character is rejected because it could split or distort terminal output. Ordinary CRLF line endings are handled, but a blank line at the end of the list is still invalid. The generator does not trim, lowercase, slugify, decode, or rename segments, and exact string checks keep case variants distinct.
Know the generator’s boundaries before pasting a large list
- Input size: The complete input may contain at most 100,000 UTF-16 code units and 2,000 path lines.
- Path depth: Each path may contain at most 128 segments.
- Segment length: Each segment may contain at most 255 UTF-16 code units.
- Rendered output: The tree has an independent ceiling of 500,000 UTF-16 code units because repeated parent prefixes can make the output larger than the source list.
Every exact boundary is accepted, while the next unit, line, segment, or output code unit is rejected with an error. The tool does not return a shortened name, sampled branch, first-N subset, or partial tree. It also does not promise full Windows filename validity beyond its disclosed safety rules.
Review the structure before printing or publishing it
Parsing, validation, sorting, rendering, and clipboard writing all happen in the current browser tab. Pasted file names and project structure are not uploaded to Lizely or sent to an external API. The tool does not request folder access, inspect file contents, read ignore files, label symbolic links, calculate sizes, add comments, discover permissions, or compare the typed list with a real repository.
A directory tree can still reveal internal module names, customer names, deployment layouts, or security-sensitive filenames even when file contents are absent. The generator does not redact secrets or sensitive names. Review the full tree and remove anything that should not appear in a printed page, public issue, shared document, or code review.