Skip to content

Instantly share code, notes, and snippets.

@mandric
Created May 2, 2012 00:21
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 mandric/2572577 to your computer and use it in GitHub Desktop.
Save mandric/2572577 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import os,sys
tiles = []
if len(sys.argv) != 2:
print 'Usage: upload-files db'
exit(1)
else:
db = sys.argv[1]
for root, dir, files in os.walk('.'):
for png in files:
tiles.append(os.path.join(root, png))
for tile in tiles:
cmd = "curl -X PUT {0}/{1}/{2} -H \
'content-type: image/png' --data-binary @{3}".format(
db,
tile.replace('.png', '').replace('/', '-').replace('.-', ''),
tile.replace('/', '-').replace('.-',''),
tile)
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment