From ff21db38c70db485bb6c188221c8a6a2407d87b2 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Fri, 19 Apr 2013 16:28:29 -0700 Subject: [PATCH 1/2] Add --no-sync-check parameter. --- S3/Config.py | 1 + s3cmd | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/S3/Config.py b/S3/Config.py index 939c83a..18594db 100644 --- a/S3/Config.py +++ b/S3/Config.py @@ -71,6 +71,7 @@ class Config(object): default_mime_type = "binary/octet-stream" guess_mime_type = True # List of checks to be performed for 'sync' + no_check_md5 = False sync_checks = ['size', 'md5'] # 'weak-timestamp' # List of compiled REGEXPs exclude = [] diff --git a/s3cmd b/s3cmd index a802881..a689bbe 100755 --- a/s3cmd +++ b/s3cmd @@ -1062,7 +1062,7 @@ def _compare_filelists(src_list, dst_list, src_is_local_and_dst_is_remote, src_a u"XFER: %s (size mismatch: src=%s dst=%s)" % (file, src_list[file]['size'], dst_list[file]['size'])) attribs_match = False - if attribs_match and 'md5' in cfg.sync_checks: + if attribs_match and 'md5' in cfg.sync_checks and not cfg.no_check_md5: ## ... same size, check MD5 if src_and_dst_remote: src_md5 = src_list[file]['md5'] @@ -3270,6 +3270,8 @@ def main(): help="Number of retry before failing GET or PUT.") optparser.add_option("--retry-delay", dest="retry_delay", type="int", action="store", default=3, help="Time delay to wait after failing GET or PUT.") + optparser.add_option("--no-check-md5", dest="no_check_md5", action="store_false", + help="Skip md5 integrity check when using sync.") optparser.set_usage(optparser.usage + " COMMAND [parameters]") optparser.set_description('S3cmd is a tool for managing objects in ' + From 496247ed1cbcb9b1a59285e21d7d413e7de28501 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Mon, 22 Apr 2013 10:35:50 -0700 Subject: [PATCH 2/2] Don't try to treat directories like files. --- s3cmd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/s3cmd b/s3cmd index a689bbe..357d927 100755 --- a/s3cmd +++ b/s3cmd @@ -1300,6 +1300,11 @@ def do_remote2local_work(item, seq, total): s3 = S3(Config()) uri = S3Uri(item['object_uri_str']) dst_file = item['local_filename'] + + # is this actually a directory? skip it. + if os.path.isdir(dst_file): + return + seq_label = "[%d of %d]" % (seq, total) try: dst_dir = os.path.dirname(dst_file)