path = "C:code" import glob txtfiles = [] for file in glob.glob(path + "*.m4a"): txtfiles.append(file) for item in txtfiles: print(item)