Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created March 29, 2013 14:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/5271286 to your computer and use it in GitHub Desktop.
Save tmcw/5271286 to your computer and use it in GitHub Desktop.
A little helper for there and back again gifs

When run in a directory of gifs, this numbers them and makes an a b c d animation go a b c d d c b a.

import glob, shutil
num = [(int(n.split('.')[0]), n) for n in glob.glob('*.gif')]
m = max(map(lambda x: x[0], num))
i = 0
for n, f in reversed(num):
i = i + 1
print "%06d.gif" % (m + i)
shutil.copyfile(f, "%06d.gif" % (m + i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment