[Python] How to download a subset of dataset from AWS CLI? Either bash script or python...

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    #!/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


    My need 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 in a way like this 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?

    Continue reading...

Compartilhe esta Página