We have S3 bucket for which we need to set up retention policy of 7 days for it folder and subfolders. I wrote the below code however it gives me folders and files both. I need just files (like we use -files paramater in GCI command).
foreach ($o in $outbox)
Get-S3Object -BucketName $bucketname -AccessKey $accesskey -SecretKey $secretkey -KeyPrefix $o | where LastModified -LT (Get-Date).AddDays(-7)