Directory Tree Package
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_pathis the current working directory (CWD) unless specified by the user.
Output
- 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
- 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 Treeuses recursion. It will raise aRecursionErroron 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 Treedoesn'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 : rahulbordoloi24@gmail.com
Metadata
Release files for directory-tree 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| directory_tree-0.0.2.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| directory_tree-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / directory_tree-0.0.2.tar.gz
| Download URL | directory_tree-0.0.2.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9da96fbdeb0e375c47012901b9e4c1fac4e960c5a9123626fd25074d4d03626d
|
|
BLAKE2b-256 checksum How to use checksums |
50fa4cea29e31232047d297b6d7e8a6defb934bb83c0a437553392a38e2831d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.6
|
Release files / directory_tree-0.0.2-py3-none-any.whl
| Download URL | directory_tree-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d67cf4fd9394b2a8dd30d2be074afc51ac61c5bd121b3bf91803e08b4fb6a3d
|
|
BLAKE2b-256 checksum How to use checksums |
89be02240d063df7e89e95680401b1d824018f77b571ac096b2c3cf20b4a07d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.6
|