From 691101ff57140b38f5aaed6454c28f36b0d8c4e2 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Fri, 6 Aug 2010 02:18:25 -0400 Subject: Prettied s3upload output --- scripts/s3upload.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts/s3upload.py') 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: -- cgit v1.2.3-70-g09d2