A little recursive function that return the list of absolute path of all the file in a folder.
from os import listdir
from os.path import isfile
def get_file_in_folder(path="."):
if isfile(path):
return path
return [get_file_in_folder(path + "/" + subfile) for subfile in listdir(path)]
def flatten(list_of_list):
return [x for l in list_of_list if type(l) == list for x in l ] + [s for s in list_of_list if type(s) == str ]