Skip to content

Instantly share code, notes, and snippets.

@andresdhn
Created November 7, 2016 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andresdhn/4c4c9a1587e2f57c3f0f6df3dcd79e7c to your computer and use it in GitHub Desktop.
Save andresdhn/4c4c9a1587e2f57c3f0f6df3dcd79e7c to your computer and use it in GitHub Desktop.
Rename files sequentially using Python
import glob, re, os
for filename in glob.glob('/Users/your-name/Documents/presentation/*.jpg'):
new_name = filename.replace("slide", "slide-")
print filename
print new_name
os.rename(filename, new_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment