From 9c11c6af2b0ac713ddcd950123d1db3b17515efa Mon Sep 17 00:00:00 2001 From: Sabu George Date: Wed, 2 Feb 2022 17:24:05 +0530 Subject: [PATCH] [WIP]: taking care of the corner case folder created from S3 --- cloudpathlib/s3/s3client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudpathlib/s3/s3client.py b/cloudpathlib/s3/s3client.py index 4a94651c..f736cd71 100644 --- a/cloudpathlib/s3/s3client.py +++ b/cloudpathlib/s3/s3client.py @@ -197,7 +197,8 @@ def _list_dir(self, cloud_path: S3Path, recursive=False) -> Iterable[S3Path]: # files in the directory for result_key in result.get("Contents", []): - yield self.CloudPath(f"s3://{cloud_path.bucket}/{result_key.get('Key')}") + if result_key.get('Size') > 0: + yield self.CloudPath(f"s3://{cloud_path.bucket}/{result_key.get('Key')}") def _move_file(self, src: S3Path, dst: S3Path, remove_src: bool = True) -> S3Path: # just a touch, so "REPLACE" metadata