How to display only files from aws s3 ls command?

后端 未结 9 844
北恋
北恋 2021-01-01 08:09

I am using the aws cli to list the files in an s3 bucket using the following command (documentation):

aws s3 ls s3://mybucket --recursive --human-readable --         


        
9条回答
  •  [愿得一人]
    2021-01-01 08:49

    A simple filter would be:

    aws s3 ls s3://mybucket --recursive | perl -pe 's/^(?:\S+\s+){3}//'
    

    This will remove the date, time and size. Left only the full path of the file. It also works without the recursive and it should also works with filename containing spaces.

提交回复
热议问题