https://github.com/gabrielstork/directory-structure
:package: Print a directory tree structure in your Python code.
https://github.com/gabrielstork/directory-structure
directory emoji file folder structure tree
Last synced: 9 days ago
JSON representation
:package: Print a directory tree structure in your Python code.
- Host: GitHub
- URL: https://github.com/gabrielstork/directory-structure
- Owner: gabrielstork
- License: mit
- Created: 2021-07-29T14:09:42.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-16T21:16:23.000Z (over 4 years ago)
- Last Synced: 2026-01-07T06:43:56.663Z (19 days ago)
- Topics: directory, emoji, file, folder, structure, tree
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 54
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# directory-structure






Print a directory tree structure in your Python code.
## Download
You can simply:
```sh
pip install directory-structure
```
Or you can also:
1. Clone the repository to your local machine.
2. Enter the directory.
3. Download necessary modules/libraries.
```sh
git clone https://github.com/gabrielstork/directory-structure.git
cd directory-structure
pip install -r requirements.txt
```
## Examples
```python
from directory_structure import Tree
```
Using absolute path as an argument.
```python
path = Tree('C:/Users/User/Desktop/directory-structure', absolute=True)
print(path)
```
```text
📂 C:
|_📂 Users
|_📂 User
|_📂 Desktop
|_📂 directory-structure
|_📁 .git
|_📁 directory_structure
|_📄 .gitignore
|_📄 LICENSE
|_📄 pyproject.toml
|_📄 README.md
|_📄 requirements.txt
|_📄 setup.py
```
```python
path = Tree('C:/Users/User/Desktop/directory-structure', absolute=False)
print(path)
```
```text
📂 directory-structure
|_📁 .git
|_📁 directory_structure
|_📄 .gitignore
|_📄 LICENSE
|_📄 pyproject.toml
|_📄 README.md
|_📄 requirements.txt
|_📄 setup.py
```
Accessing a folder in current working directory.
```python
path = Tree('./directory_structure', absolute=True)
print(path)
```
```text
📂 C:
|_📂 Users
|_📂 User
|_📂 Desktop
|_📂 directory-structure
|_📂 directory_structure
|_📄 tree.py
|_📄 __init__.py
```
```python
path = Tree('./directory_structure', absolute=False)
print(path)
```
```text
📂 directory_structure
|_📄 tree.py
|_📄 __init__.py
```
Getting all from the directory where your current working directory is.
```python
path = Tree('../', absolute=True)
print(path)
```
```text
📂 C:
|_📂 Users
|_📂 User
|_📂 Desktop
|_📁 directory-structure
|_📄 Discord.lnk
|_📄 Spotify.lnk
|_📄 Steam.lnk
|_📄 Telegram.lnk
|_📄 Visual Studio Code.lnk
|_📄 WhatsApp.lnk
```
```python
path = Tree('../', absolute=False)
print(path)
```
```text
📂 Desktop
|_📁 directory-structure
|_📄 Discord.lnk
|_📄 Spotify.lnk
|_📄 Steam.lnk
|_📄 Telegram.lnk
|_📄 Visual Studio Code.lnk
|_📄 WhatsApp.lnk
```
[](https://github.com/gabrielstork)
[](https://github.com/gabrielstork)