Reputation: 8354
I want to move files from a bucket, to the same bucket/folder.
The test
folder already exists.
srcBucket = "tmp"
dstBucket = "tmp"
import boto
c = boto.connect_s3()
src = c.get_bucket(srcBucket)
dst = c.get_bucket(dstBucket)
print dst
for k in src.list():
# copy stuff to your destination here
dst.copy_key(k.key, src.name, "/test/"+k.key)
I am getting:
<Message>The specified key does not
exist.</Message><Key>/test/00hbgelokd2i5nglv6opbte003gorrnahv65uo81</Key>
Upvotes: 1
Views: 1120
Reputation: 178956
Object keys in S3 do not begin with a /
.
The key for the object at http://example-bucket.s3.amazonaws.com/foo/bar.txt
is foo/bar.txt
, not /foo/bar.txt
.
So, in your example, "/test/"+k.key
should be "test/"+k.key
.
Upvotes: 1