'List Objects from AWS S3 bucket using ASP.NET

I have an S3 bucket which has multiple folders. I want to list S3 objects from specific sub folders. For example my folder structure is: Folder1/Download, Folder1/Upload. Here, I want the objects only from Folder1/Download and not the upload. The function that I'm using is:

public void GetFTPFilesAWS(long ID)
        {
            AmazonS3Client amazonS3Client = new AmazonS3Client("", "", Amazon.Region);
            ListObjectsRequest request = new ListObjectsRequest
            {
                BucketName = "",
                //Prefix = "Download",
                //Delimiter = "/"
            };
            var practiceFolderName = "Practice_" + ID;
            string[] businessClaim = { "Folder1/Download/", "Folder2/Download/",};
            foreach (string s in businessClaim)
            {
                _ = practiceFolderName + s;
            }
            ListObjectsResponse response = amazonS3Client.ListObjects(request);


        }

I'm getting every object from my bucket using this and when I'm trying to use the prefix and delimiter it's not working.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source