Skip to content

Instantly share code, notes, and snippets.

@jait
Created October 24, 2011 16:03
Show Gist options
  • Save jait/1309385 to your computer and use it in GitHub Desktop.
Save jait/1309385 to your computer and use it in GitHub Desktop.
DCIMify
#!/usr/bin/python
import os
INDEX = 0
def get_filename():
global INDEX
name = 'DSC_%04d.JPG' % INDEX
INDEX += 1
return name
def main():
for filename in os.listdir('.'):
if filename.endswith('.jpg'):
os.rename(filename, get_filename())
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment