-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhey.py
More file actions
24 lines (18 loc) · 737 Bytes
/
hey.py
File metadata and controls
24 lines (18 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
def tree(dir_path, prefix=""):
# Get a sorted list of files and directories
entries = sorted(os.listdir(dir_path))
entries_count = len(entries)
for index, entry in enumerate(entries):
path = os.path.join(dir_path, entry)
connector = "├── " if index < entries_count - 1 else "└── "
print(prefix + connector + entry)
if os.path.isdir(path):
extension = "│ " if index < entries_count - 1 else " "
tree(path, prefix + extension)
if __name__ == "__main__":
import sys
# Use current directory or user-provided path
base_path = "/home/raj/Documents/CODING/Ionia/ionia-next/PraisonAI"
print(base_path)
tree(base_path)