Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow stdout as destination when receiving multiple remote files

- special case stdout when enforcing destination rules
- update parameter error output to indicate stdout is a valid destination specification
  • Loading branch information...
commit 2320b45473655d27291799eebd73d216a0c21943 1 parent bcb4442
Rob Wills ohhorob authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 s3cmd
11 s3cmd
View
@@ -336,6 +336,7 @@ def cmd_object_get(args):
## - apply exclude/include rules
## - each list item will have MD5sum, Timestamp and pointer to S3Uri
## used as a prefix.
+ ## - the last arg may be '-' (stdout)
## - the last arg may be a local directory - destination_base
## - if the last one is S3 make current dir the destination_base
## - if the last one doesn't exist check remote list:
@@ -369,10 +370,14 @@ def cmd_object_get(args):
info(u"Summary: %d remote files to download" % remote_count)
if remote_count > 0:
- if not os.path.isdir(destination_base) or destination_base == '-':
- ## We were either given a file name (existing or not) or want STDOUT
+ if destination_base == "-":
+ ## stdout is ok for multiple remote files!
+ for key in remote_list:
+ remote_list[key]['local_filename'] = "-"
+ elif not os.path.isdir(destination_base):
+ ## We were either given a file name (existing or not)
if remote_count > 1:
- raise ParameterError("Destination must be a directory when downloading multiple sources.")
+ raise ParameterError("Destination must be a directory or stdout when downloading multiple sources.")
remote_list[remote_list.keys()[0]]['local_filename'] = deunicodise(destination_base)
elif os.path.isdir(destination_base):
if destination_base[-1] != os.path.sep:
Please sign in to comment.
Something went wrong with that request. Please try again.