diff options
Diffstat (limited to 'scripts/s3upload.py')
| -rw-r--r-- | scripts/s3upload.py | 10 |
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:
|
