From af984ba90f53366cf7883a06b6db114ff647e3ec Mon Sep 17 00:00:00 2001 From: Christopher Porter Date: Fri, 6 Jan 2012 21:42:43 -0800 Subject: [PATCH] Fixing bug 3091912 - KeyError when copying multiple keys When you use 's3cmd cp' to copy multiple keys (without using the recursive flag) you get a Key Error. s3cmd cp s3://source-bucket/prefix* s3://target-bucket Logged here: http://sourceforge.net/tracker/?func=detail&aid=3091912&group_id=178907&atid=887015 and here: https://bugs.launchpad.net/ubuntu/+source/s3cmd/+bug/523586 --- s3cmd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/s3cmd b/s3cmd index cb0cd022d..df907c8a2 100755 --- a/s3cmd +++ b/s3cmd @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python ## Amazon S3 manager ## Author: Michal Ludvig @@ -509,11 +509,11 @@ def subcmd_cp_mv(args, process_fce, action_str, message): for key in remote_list: remote_list[key]['dest_name'] = destination_base + key else: - key = remote_list.keys()[0] - if destination_base.endswith("/"): - remote_list[key]['dest_name'] = destination_base + key - else: - remote_list[key]['dest_name'] = destination_base + for key in remote_list: + if destination_base.endswith("/"): + remote_list[key]['dest_name'] = destination_base + key + else: + remote_list[key]['dest_name'] = destination_base if cfg.dry_run: for key in exclude_list: