22 lines
638 B
Python
22 lines
638 B
Python
from os import listdir
|
|
from os.path import isfile, isdir, realpath
|
|
|
|
|
|
def recursive_list_dir(path) -> list[str]:
|
|
try:
|
|
# place to accumulate all the state files
|
|
file_list = []
|
|
|
|
# list all the files that are in the directory pointed to by path
|
|
current_contents = [ f"{path}/{x}" for x in listdir(path) if not x.endswith("/.git") or not isdir(x) ]
|
|
|
|
for file in current_contents:
|
|
if isdir(file):
|
|
file_list.extend(recursive_list_dir(file))
|
|
elif isfile(file):
|
|
file_list.append(file)
|
|
|
|
return file_list
|
|
|
|
except Exception:
|
|
raise |