Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* s3cmd: Added --list-md5 for 'ls' command.

* S3/Config.py: New setting list_md5


git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@371 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information...
commit 8567b8ed6ba3bb08eb266792f203140f8363cecf 1 parent 96b5004
@mludvig mludvig authored
Showing with 30 additions and 8 deletions.
  1. +5 −0 ChangeLog
  2. +5 −0 NEWS
  3. +1 −0  S3/Config.py
  4. +19 −8 s3cmd
View
5 ChangeLog
@@ -1,5 +1,10 @@
2009-02-12 Michal Ludvig <michal@logix.cz>
+ * s3cmd: Added --list-md5 for 'ls' command.
+ * S3/Config.py: New setting list_md5
+
+2009-02-12 Michal Ludvig <michal@logix.cz>
+
* s3cmd: Set Content-Length header for requests with 'body'.
* s3cmd: And send it for requests with no body as well...
View
5 NEWS
@@ -1,3 +1,8 @@
+s3cmd 0.9.9
+===========
+* Added --list-md5 option for [ls].
+* Always send Content-Length header to satisfy some http proxies.
+
s3cmd 0.9.9-rc3 - 2009-02-02
===============
* Fixed crash in S3Error().__str__() (typically Amazon's Internal
View
1  S3/Config.py
@@ -24,6 +24,7 @@ class Config(object):
progress_class = Progress.ProgressCR
send_chunk = 4096
recv_chunk = 4096
+ list_md5 = False
human_readable_sizes = False
force = False
get_continue = False
View
27 s3cmd
@@ -118,18 +118,28 @@ def subcmd_bucket_list(s3, uri):
else:
raise
+ if cfg.list_md5:
+ format_string = u"%(timestamp)16s %(size)9s%(coeff)1s %(md5)32s %(uri)s"
+ else:
+ format_string = u"%(timestamp)16s %(size)9s%(coeff)1s %(uri)s"
+
for prefix in response['common_prefixes']:
- output(u"%s %s" % (
- "DIR".rjust(26),
- uri.compose_uri(bucket, prefix["Prefix"])))
+ output(format_string % {
+ "timestamp": "",
+ "size": "DIR",
+ "coeff": "",
+ "md5": "",
+ "uri": uri.compose_uri(bucket, prefix["Prefix"])})
for object in response["list"]:
size, size_coeff = formatSize(object["Size"], Config().human_readable_sizes)
- output(u"%s %s%s %s" % (
- formatDateTime(object["LastModified"]),
- str(size).rjust(8), size_coeff.ljust(1),
- uri.compose_uri(bucket, object["Key"]),
- ))
+ output(format_string % {
+ "timestamp": formatDateTime(object["LastModified"]),
+ "size" : str(size),
+ "coeff": size_coeff,
+ "md5" : object['ETag'].strip('"'),
+ "uri": uri.compose_uri(bucket, object["Key"]),
+ })
def cmd_bucket_create(args):
s3 = S3(Config())
@@ -1367,6 +1377,7 @@ def main():
optparser.add_option( "--encoding", dest="encoding", metavar="ENCODING", help="Override autodetected terminal and filesystem encoding (character set). Autodetected: %s" % preferred_encoding)
+ optparser.add_option( "--list-md5", dest="list_md5", action="store_true", help="Include MD5 sums in bucket listings (only for 'ls' command).")
optparser.add_option("-H", "--human-readable-sizes", dest="human_readable_sizes", action="store_true", help="Print sizes in human readable form.")
optparser.add_option( "--progress", dest="progress_meter", action="store_true", help="Display progress meter (default on TTY).")
Please sign in to comment.
Something went wrong with that request. Please try again.