#walk : used to give you the path of files in folder import os lst = [] def list_files(mainPath): for d, sb, f in os.walk(mainPath): for file_name in f: full_path = os.path.join(d, file_name) lst.append(full_path) list_files(r"C:\Users\osama\Desktop\New folder") print(lst)