diff --git a/mass_s3/mass_s3.py b/mass_s3/mass_s3.py index 095361d..8240f4c 100644 --- a/mass_s3/mass_s3.py +++ b/mass_s3/mass_s3.py @@ -69,6 +69,7 @@ class MassS3: if owner is not None: args['FetchOwner'] = True + total = 0 while True: list_objects_response = self.s3.list_objects_v2(**args) @@ -78,11 +79,12 @@ class MassS3: for item in list_objects_response['Contents']: if modified_since is not None and item['LastModified'] < modified_since: continue - if owner is not None and item['Owner']['ID'] != owner: + if owner is not None and item['Owner']['DisplayName'] != owner: continue objects.append(item['Key']) - self.logger.debug('Retrieved ' + str(len(list_objects_response['Contents'])) + ' objects; kept ' + str(len(objects)) + ' so far') + total = total + len(list_objects_response['Contents']) + self.logger.debug('Got ' + str(total) + ' objects; kept ' + str(len(objects))) if 'NextContinuationToken' in list_objects_response: args['ContinuationToken'] = list_objects_response['NextContinuationToken']