Created
August 5, 2022 06:37
-
-
Save PaulleDemon/2fc8f70cdb1929f6cc062afab67222bd to your computer and use it in GitHub Desktop.
walks through a specified directory listing all the files and folders in with indent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# used to generate file overview | |
import os | |
ignore_dirs = ['.git'] | |
ignore_files = ['.env'] | |
def path_tree(root, inner=0): | |
for dir in os.listdir(root): | |
# print("DIR: ", root, dirs, files) | |
complete_path = os.path.join(root, dir) | |
if os.path.isdir(complete_path) and dir not in ignore_dirs: | |
print("\t"*inner, dir) | |
path_tree(complete_path, inner+1) | |
elif os.path.isfile(complete_path) and dir not in ignore_files: | |
print("\t"*inner, dir) | |
path_to_dir = "/home/devilman/Desktop/loner" | |
path_tree(path_to_dir) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment