summaryrefslogtreecommitdiff
path: root/scripts/s3upload.py
diff options
context:
space:
mode:
authorScott Ostler <scottbot9000@gmail.com>2010-08-06 02:18:25 -0400
committerScott Ostler <scottbot9000@gmail.com>2010-08-06 02:18:25 -0400
commit691101ff57140b38f5aaed6454c28f36b0d8c4e2 (patch)
tree8c901c97060e157594271b3da070a356cbc916f0 /scripts/s3upload.py
parent9bc6d61a586186b834ecca8f4081b966fd4f3395 (diff)
Prettied s3upload output
Diffstat (limited to 'scripts/s3upload.py')
-rw-r--r--scripts/s3upload.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/s3upload.py b/scripts/s3upload.py
index d355dfd..65eb66d 100644
--- a/scripts/s3upload.py
+++ b/scripts/s3upload.py
@@ -22,7 +22,6 @@ def upload_file(path, dry_run=True):
content_type = 'text/plain'
path = path.replace('\\', '/') # Windows hack
- print '- %s' % path
if not dry_run:
CONN.put(BUCKET_NAME, path, S3.S3Object(filedata),
{'x-amz-acl': 'public-read', 'Content-Type': content_type})
@@ -31,22 +30,23 @@ def upload_file(path, dry_run=True):
def do_upload(directory, start_date, end_date, dry_run=True):
global CONN
CONN = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
- counter = 0
- for subdir in os.listdir(directory):
+
+ for subdir in sorted(os.listdir(directory)):
subdir_date = None
try:
subdir_date = parse_date(subdir)
except:
continue
+ counter = 0
if start_date <= subdir_date <= end_date:
- print "uploading contents of %s" % subdir
+ print "uploading contents of %s" % subdir,
for filename in os.listdir(os.path.join(directory, subdir)):
path = os.path.join(directory, subdir, filename)
upload_file(path, dry_run=dry_run)
counter += 1
- print '\nUploaded %s files' % counter
+ print 'handled %s files' % counter
if __name__ == "__main__":
if not 4 <= len(sys.argv) <= 5: