path = '/Volumes/Seagate/dev/imgs/' os.chdir(path) print('cwd: ', os.getcwd()) for f in os.listdir('.'): if not f.endswith('.jpg'): os.rename(f, f + '.jpg')