Giter VIP home page Giter VIP logo

directory-tree's Introduction

Directory Tree Package

Setup Automated Test passing Python Version PyPI version Last Commit Open Source Love png2

About

Want to display your project/current working directory as a neat tree? No Worries!

Directory Tree is a simple python utility package that displays out the Tree Structure of a user-defined directory.

Currently Available for All Platforms.

Installation

Run the following command on your terminal to install directory_tree:

1 . Installing the package using pip:

pip install directory_tree

OR

pip3 install directory_tree

2 . Cloning the repository:

git clone https://github.com/rahulbordoloi/Directory-Tree/
cd Directory-Tree
pip install -e .

Usage

Arguments

Parameters Description
dir_path Refers to the Directory Path of Operation. By default, refers to the Current Working Directory.
string_rep Refers to whether you just want the direct output or a string representation of the same.

Run this script in order to print out the tree structure of a user-defined directory!

# Importing Libraries
from directory_tree import display_tree

# Main Method
if __name__ == '__main__':
    display_tree(directory_path)
  • Here by default, the directory_path is the current working directory (CWD) unless specified by the user.

Output

  1. For Current Working Directory [DEFAULT] [String Representation = False]
>>> from directory_tree import display_tree
>>> display_tree()

$ Operating System : Windows
$ Path : C:\Personal\Work\Directory-Tree\Test\Main Directory

*************** Directory Tree ***************

Main Directory/
├── Directory 1/
│   └── Directory 2/
│       ├── Directory 3/
│       │   └── Directory 4/
│       │       └── Hello World.txt
│       └── Say World.txt
├── Directory A/
│   └── Hmm.txt
├── directory-tree-print.cpp
├── letseee.txt
└── printTree.exe
  1. For User Specified Directory [Argument] [String Representation = True]
>>> from directory_tree import display_tree
>>> stringRepresentation = display_tree('C:\Personal\Work\Directory-Tree\Test\Main Directory', string_rep = True)
>>> print(stringRepresentation)

$ Operating System : Windows
$ Path : C:\Personal\Work\Directory-Tree\Test\Main Directory

*************** Directory Tree ***************

Main Directory/
├── Directory 1/
│   └── Directory 2/
│       ├── Directory 3/
│       │   └── Directory 4/
│       │       └── Hello World.txt
│       └── Say World.txt
├── Directory A/
│   └── Hmm.txt
├── directory-tree-print.cpp
├── letseee.txt
└── printTree.exe

Developing Directory Tree

To install directory_tree, along with the tools you need to develop and run tests, and execute the following in your virtualenv:

$ pip install -e .[dev]

Security & Bugs

  • Directory Tree uses recursion. It will raise a RecursionError on really deep directory trees.
  • As the tree is lazily evaluated, it should behave well on really wide directory trees. Immediate children of a given directory are not lazily evaluated, though. It would be prompted to the last.
  • Currently Directory Tree doesn't support the functionality of ignoring files/directories in a particular path, so will print every files-directories present in the given path.
  • If you're a Windows user, it is always advised to use \\ instead of \ in the address as using \ might catchup escape sequences and corrupt the address string.

Contact Author

Name : Rahul Bordoloi
Website : https://rahulbordoloi.me
Email : [email protected]

forthebadge made-with-python ForTheBadge built-with-love

directory-tree's People

Contributors

rahulbordoloi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.