Created
May 2, 2012 00:21
-
-
Save mandric/2572577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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