diff options
author | Paul Armstrong <github@otoh.org> | 2012-02-10 09:13:26 -0800 |
---|---|---|
committer | Paul Armstrong <github@otoh.org> | 2012-02-10 09:13:26 -0800 |
commit | 9289efed729546df092ea33e48d9726dee61126f (patch) | |
tree | 13f38f7f9b9f3493be9a44d82c50cafee3a0855f | |
parent | 0f16d4667f7a5b16aadcaec030de8407af4a7226 (diff) | |
download | boto-9289efed729546df092ea33e48d9726dee61126f.tar.gz |
Add a prefix to b.list() so s3put/s3multiput don't list the whole bucket
Listing the whole bucket to avoid overwriting keys is extremely
inefficient (especially for buckets will millions or billions of
objects). Use the path provided by the user to add a prefix to b.list()
so that the keyspace is reduced to just the area we're trying to sync.
-rwxr-xr-x | bin/s3multiput | 2 | ||||
-rwxr-xr-x | bin/s3put | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/bin/s3multiput b/bin/s3multiput index 095737ac..644ddc91 100755 --- a/bin/s3multiput +++ b/bin/s3multiput @@ -256,7 +256,7 @@ def main(): if not quiet: print 'Getting list of existing keys to check against' keys = [] - for key in b.list(): + for key in b.list(get_key_name(path, prefix)): keys.append(key.name) for root, dirs, files in os.walk(path): for ignore in ignore_dirs: @@ -162,7 +162,7 @@ def main(): if not quiet: print 'Getting list of existing keys to check against' keys = [] - for key in b.list(): + for key in b.list(get_key_name(path, prefix)): keys.append(key.name) for root, dirs, files in os.walk(path): for ignore in ignore_dirs: |