How to display only files from aws s3 ls command?

后端 未结 9 908
北恋
北恋 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:55

    For only the file names, I find the easiest to be:

    aws s3 ls s3://path/to/bucket/ | cut -d " " -f 4

    This will cut the returned output at the spaces (cut -d " ") and return the fourth column (-f 4), which is the list of file names.

提交回复
热议问题