summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Armstrong <github@otoh.org>2012-02-10 09:13:26 -0800
committerPaul Armstrong <github@otoh.org>2012-02-10 09:13:26 -0800
commit9289efed729546df092ea33e48d9726dee61126f (patch)
tree13f38f7f9b9f3493be9a44d82c50cafee3a0855f
parent0f16d4667f7a5b16aadcaec030de8407af4a7226 (diff)
downloadboto-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-xbin/s3multiput2
-rwxr-xr-xbin/s3put2
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:
diff --git a/bin/s3put b/bin/s3put
index 972d6279..a5bf30c7 100755
--- a/bin/s3put
+++ b/bin/s3put
@@ -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: