For enable CLI Command, kindly Download the below msi file and install it.
Download .msi to enable CLI command
CLI COMMAND
C:\> aws s3 cp "s3://myFolers3bucket/FILE" . --recursive
C# code to download files from S3 bucket.
string accessKey = "abc123353";
string secretKey = "secret1233534";
string bucketName = "
myFolers3bucket
"
TransferUtility fileTransferUtility = new TransferUtility(new AmazonS3Client(accessKey, secretKey, Amazon.RegionEndpoint.USEast2));
BasicAWSCredentials basicCredentials = new BasicAWSCredentials(accessKey,secretKey);
AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey), Amazon.RegionEndpoint.USEast2);
ListObjectsRequest request = new ListObjectsRequest();
ListObjectsResponse response = s3Client.ListObjects(request.BucketName= bucketName, request.Prefix="FILE/");
foreach (S3Object obj in response.S3Objects)
{
try
{
Console.WriteLine("{0}", obj.Key);
fileTransferUtility.Download(@"C:\DownloadTemp", bucketName, obj.Key);
}
catch (Exception Excep)
{
Console.WriteLine(Excep.Message, Excep.InnerException);
}
}