We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab078c1 commit 065a770Copy full SHA for 065a770
1 file changed
filetree.py
@@ -0,0 +1,18 @@
1
+import os
2
+
3
+def print_directory_tree(root_path, indent=""):
4
+ """
5
+ Recursively prints the directory tree starting from the given root path.
6
7
+ print(f"{indent} {os.path.basename(root_path)}/")
8
9
+ for entry in os.listdir(root_path):
10
+ entry_path = os.path.join(root_path, entry)
11
+ if os.path.isdir(entry_path):
12
+ print_directory_tree(entry_path, indent + " ")
13
+ else:
14
+ print(f"{indent} {entry}")
15
16
+base_directory = os.path.dirname(os.path.abspath(__file__))
17
18
+print_directory_tree(base_directory)
0 commit comments