Skip to content

Instantly share code, notes, and snippets.

@ben-hearn-sb
Created January 24, 2021 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ben-hearn-sb/a626215d95f1b292e66b388be3c1eb2b to your computer and use it in GitHub Desktop.
Save ben-hearn-sb/a626215d95f1b292e66b388be3c1eb2b to your computer and use it in GitHub Desktop.
def recurse_map_file_paths(input_dirs=None):
""" Recursively maps an input directory """
if not type(input_dirs) is list:
input_dirs = [input_dirs]
file_paths = list()
for d in input_dirs:
for root, folder, filenames in os.walk(d):
for f in filenames:
if f.lower().endswith(cfg.file_types):
fpath = os.path.join(root, f).replace('\\', '/').strip()
fpath = normalize_filepath(fpath)
if not fpath in file_paths:
file_paths.append(fpath)
return file_paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment