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 --
You can't do this with just the aws
command, but you can easily pipe it to another command to strip out the portion you don't want. You also need to remove the --human-readable
flag to get output easier to work with, and the --summarize
flag to remove the summary data at the end.
Try this:
aws s3 ls s3://mybucket --recursive | awk '{print $4}'
Edit: to take spaces in filenames into account:
aws s3 ls s3://mybucket --recursive | awk '{$1=$2=$3=""; print $0}' | sed 's/^[ \t]*//'