Skip to content

Instantly share code, notes, and snippets.

@Lucs1590
Last active March 22, 2021 00:58
Show Gist options
  • Save Lucs1590/22f005f182673a62c38447b62d4325eb to your computer and use it in GitHub Desktop.
Save Lucs1590/22f005f182673a62c38447b62d4325eb to your computer and use it in GitHub Desktop.
This is a code to rename a lot of things using Python 3
# Pythono3 code to rename multiple
import os
import glob
def main():
caminho = "path/to/archives/"
for i, arquivo in enumerate(glob.glob(os.path.join(caminho, "*.jpg"))):
new_file = caminho + "name" + str(i) + ".jpg"
os.rename(arquivo, new_file)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment