This lets us delete much faster.
Matt Domsch authored on 2014/03/15 10:35:30... | ... |
@@ -505,16 +505,21 @@ def cmd_object_get(args): |
505 | 505 |
output(u"File %s removed after fetch" % (uri)) |
506 | 506 |
|
507 | 507 |
def cmd_object_del(args): |
508 |
+ recursive = Config().recursive |
|
508 | 509 |
for uri_str in args: |
509 | 510 |
uri = S3Uri(uri_str) |
510 | 511 |
if uri.type != "s3": |
511 | 512 |
raise ParameterError("Expecting S3 URI instead of '%s'" % uri_str) |
512 | 513 |
if not uri.has_object(): |
513 |
- if Config().recursive and not Config().force: |
|
514 |
+ if recursive and not Config().force: |
|
514 | 515 |
raise ParameterError("Please use --force to delete ALL contents of %s" % uri_str) |
515 |
- elif not Config().recursive: |
|
516 |
+ elif not recursive: |
|
516 | 517 |
raise ParameterError("File name required, not only the bucket name. Alternatively use --recursive") |
517 |
- subcmd_object_del_uri(uri_str) |
|
518 |
+ |
|
519 |
+ if not recursive: |
|
520 |
+ subcmd_object_del_uri(uri_str) |
|
521 |
+ else: |
|
522 |
+ subcmd_batch_del(uri_str) |
|
518 | 523 |
|
519 | 524 |
def subcmd_batch_del(uri_str = None, bucket = None, remote_list = None): |
520 | 525 |
s3 = S3(cfg) |