Python Print Directory Tree

Mimicking Linux Tree Utility

Introduction

Many blogs are showing how to print directory tree using Python. Drawing from those examples, we built our version. The primary drivers were:

  1. Compatibility with Python3
  2. Print symbolic links
  3. Limit depth of tree

Example output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10 …
more ...