title: Is there a way ito iterate the list of files from aws s3 bucket in shell scripting?
body: <p>I am using shell scripting and I want to get the list of files from AWS S3 bucket, and then perform a for loop based on the number of files present in list object.</p>
  
  <p>Here is my code to get the files from S3 bucket in shell script:</p>
  
  <pre><code>S3_files=$(aws s3 ls s3://s3_bucket_path/ | awk '{print $4}')
  </code></pre>
  
  <p><code>S3_files</code> variable take the list of files as a whole string, so not able to iterate using the loop. The loop runs just onetime as it considers the list of files as a string, and jut run one time. Below is my code: </p>
  
  <pre><code>for i in "${S3_files[@]}"
  do
  {
    echo "$i"
  }
  done
  </code></pre>
  
  <p>So, I want to understand how we can iterate it using the loop based on the total number of files.
  Any help is appreciated. Thanks a lot!</p>