Render a text tree view, with optional color in terminals.

Render a FS object as text tree views.

fs.tree.render(fs, path=u'/', file=None, encoding=None, max_levels=5, with_color=None, dirs_first=True, exclude=None, filter=None)

Render a directory structure in to a pretty tree.

  • fs (A FS instance) – A filesystem.
  • file (file or None) – An open file-like object to render the tree, or None for stdout.
  • max_levels (int) – Maximum number of levels to display, or None for no maximum.
  • with_color (bool) – Enable terminal color output, or None to auto-detect terminal.
  • dirs_first (bool) – Show directories first.
  • exclude (list) – Option list of directory patterns to exclude from the tree render.
  • filter – Optional list of files patterns to match in the tree render.
Return type:



A tuple of (<directory count>, <file count>).