#!/bin/bash
while IFS= read -r line
do
aws s3 cp --no-sign-request s3://.../$line E:/Papua_New_Guinea/ --region us-east-1 --no-sign-request
done <E:/Papua_New_Guinea/filenames.txt
I have the same need, which is to download a subset of dataset based on a list of file names saved in a txt file. Above is my code. When I directly executed the code in one line in Git Bash prompt, it returned nothing. But when I saved it as .sh script then call bash command to execute the script, it always threw such error message: "fatal error: An error occurred (404) when calling the HeadObject operation: Key " does not exist..."
Each file names in the txt file was listed as "132122233.tif", which "132122233" is the file id and ".tif" is the file format. Which part of my code went wrong? Could anyone offer some helps?