Skip to content

Instantly share code, notes, and snippets.

@GGontijo
Last active September 24, 2022 11:58
Show Gist options
  • Save GGontijo/76586e17164fdbbc4d615808dbcd148e to your computer and use it in GitHub Desktop.
Save GGontijo/76586e17164fdbbc4d615808dbcd148e to your computer and use it in GitHub Desktop.
Mass rename files in a folder
import os
for file in os.listdir('.'):
if file == 'rename.py':
continue
name = str(file).split(".")[0]
new_name = name + ".jpg"
os.rename(file, new_name)
print(name + " alterado para " + new_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment