How to delete the log files in Amazon s3 according to date.? I have log files in a logs folder inside my bucket.
string sdate = datetime.ToString("yyyy-MM-dd"); string key = "logs/" + sdate + "*" ; AmazonS3 s3Client = AWSClientFactory.CreateAmazonS3Client(); DeleteObjectRequest delRequest = new DeleteObjectRequest() .WithBucketName(S3_Bucket_Name) .WithKey(key); DeleteObjectResponse res = s3Client.DeleteObject(delRequest);
I tried this but doesn't seem to work. I can delete individual files if I put the whole name in the key. But I want to delete all the log files created for a particular date.