import os with os.scandir(r"C:UsersmacnameDesktop") as it: for entry in it: if not entry.name.startswith('Auto') and entry.is_file(): print(entry.name)