import os work_path = os.path.expandvars('$HOME') + '/.config/PyQtToDoList/ToDoList' # sync_path = os.walk(work_path) # print(sync_path) for root, dirs, files in os.walk(work_path, topdown=False): for name in files: print(os.path.join(root, name).split('/')[-1]) # for name in dirs: # # print(os.path.join(root, name)) # print(os.path.join(root, name).split('/')[-1])