Skip to main content

Create a nice looking directory tree with options

Project description

<style> table { text-align: center; } </style>

DirTree


Create a nice looking directory tree

Installation:

python -m pip install "BB-DirTree"

DirTree usage

dirtree [OPTIONS] [ARGS]

Options:

Short Long Description
-b     |   --base-dir       |  Set base directory <br> *Uses current directory if not specified*
-d     |   --depth          |  Integer to set the depth of directory tree <br> *ex: '0' will only print the base directory list*
-D     |   --dotfiles       |  Include hidden files in tree
-e     |   --exclude        |  Filenames/directories to exclude from the tree <br> *See Exclusions*
-h     |   --help           |  This help message
-L     |   --follow-links   |  Follow links to directories - default is NOT to follow
-q     |   --qt-html        |  Print in html format for use with QT
-r     |   --regex          |  Use regex to include/exclude files/directories in tree <br> *See Regex*
-v     |   --verbose        |  Set verbose level (1-5) or 'debug' = 1
       |   --ignore-errors  |  Ignore read errors (such as permission errors) - Default is to error and exit
       |   --no-print       |  Don't print any output
       |   --version        |  Print version info and exit

It is recommended to quote all paths

Exclusions

Provide names of files or directories to exclude. To exclude multiple files/directories, quote entire list and seperate with a colon (:). Add a forward slash (/) to specify a directory name to exclude.

Example:
dirtree --exclude "excluded dir:excluded file"

Regex

Prefix regex with include= or exclude=

Seperate each regex with a space, quoting each individual argument.

Examples:
dirtree --regex "exclude=.*\.ini$"

    # will exclude any files that have a *.ini* extension.

dirtree --regex "include=.*\.mp3$"

    # will include only files with a *.mp3* extension.

This has no effect on directories

Multiple regex can be used by specifying --regex multiple times.

License

==========

    MIT License

    Copyright (c) [2022] [Erik Beebe]

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.

CHANGELOG

============

v0.1.0 - 5-29-2022

  • initial release

v0.1.1 - 5-30-2022

  • changed name from DirTree to BB-DirTree
  • added README.md

v0.1.2 - 5-31-2022

  • added a changelog to README.md
  • made corrections to help message

v0.1.3 - 5-31-2022

  • added support for windows hidden files

v0.1.5 - 5-31-2022

  • made corrections to help message

v0.1.7 - 6-7-2022

  • changed color of files in html output
  • small changes to output format

v0.2.2 - 7-9-2023

  • added script to run from $PATH (run with 'dirtree')
  • cleaned up code
  • changed header text at top of output

v0.2.3 - 7-9-2023

  • added python project titles to output
    • searches for pyproject.toml or setup.py
  • added git project titles to output
    • searches for .SRCINFO file

v0.2.4 - 7-10-2023

  • fixed typo in main

v0.2.6 - 7-10-2023

  • bugfixes

v0.3.0 - 7-15-2023

  • added bb_apputils to dependencies
    • added bblogger for logging
  • removed doc from init.py
  • added verbose options
  • added option to ignore errors while scanning directories
  • added option to follow symlinks
  • added symlink data to output
  • added '--no-print' option for debugging
  • changed colors in output
  • changed the way the title is generated
  • updated README to reflect changes
  • cleaned up some code

v0.3.1 - 7-15-2023

  • fixed title when printing to tty

v0.3.2 - 7-15-2023

  • added colorized tree for symlinked directories
  • prevent symlinks from causing infinite recursion
    • colored recursive directory links red
  • moved formatting code to class instances

v0.3.4 - 7-15-2023

  • fixed hidden file detection in windows
  • added more title methods

v0.4.0 - 7-16-2023

  • updated bb_appdirs
  • changed some log messages
  • added more title methods
  • added a fancy title header
  • added winvolumeinfo module
  • added unixvolumeinfo module
  • added option to print version info
  • adjusted output for when base directory is a link
  • changed html colors to hex values and adjusted
  • changed tty colors to rgb values
  • changed some option arguments

v0.4.1 - 7-16-2023

  • changed base directory to show absolute path

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bb_dirtree-0.4.1.tar.gz (15.3 kB view hashes)

Uploaded Source

Built Distribution

bb_dirtree-0.4.1-py3-none-any.whl (15.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page