Skip to content

Instantly share code, notes, and snippets.

@braxton-bell
Created November 9, 2025 01:28
Show Gist options
  • Select an option

  • Save braxton-bell/07d5d53fe22c1874e2424d0c5a13a66c to your computer and use it in GitHub Desktop.

Select an option

Save braxton-bell/07d5d53fe22c1874e2424d0c5a13a66c to your computer and use it in GitHub Desktop.

πŸͺ΅ PowerShell Tree View (Clean Output, Excluding __pycache__ and .venv)

A quick way to display a clean, ASCII-style tree view of your project in PowerShell β€” no file attributes, just folder/file hierarchy β€” while excluding unwanted directories and patterns like __pycache__, .venv, and *.pyc.

πŸ“¦ Install PSTree

Install-Module PSTree -Scope CurrentUser

The -Scope CurrentUser flag installs the module for your user only, without requiring admin rights.

🌲 Generate the Tree (No Attributes)

Get-PSTree -Path . -Recurse -Exclude "__pycache__","*.pyc",".venv" | ForEach-Object Hierarchy

βš™οΈ Explanation

  • Get-PSTree β€” retrieves a hierarchical view of directories and files.
  • -Path . β€” start from the current directory.
  • -Recurse β€” traverse all subdirectories.
  • -Exclude "__pycache__","*.pyc",".venv" β€” skips Python caches, virtual environments, and compiled files.
  • | ForEach-Object Hierarchy β€” prints only the tree hierarchy (folder/file indentation lines), omitting all file attribute columns.

πŸ“– Reference

For customization options (ASCII/Unicode tree styles, colors, depth, etc.), see the official docs: πŸ‘‰ about_TreeStyle.md (PSTree Documentation)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment