使用CLI从AWS S3下载特定文件的列表 [英] Download list of specific files from AWS S3 using CLI

查看:90
本文介绍了使用CLI从AWS S3下载特定文件的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试仅从AWS下载特定文件。我有文件URL列表。使用CLI,我只能使用--recursive命令下载存储桶中的所有文件,但是我只想下载列表中的文件。有关如何执行此操作的任何想法?

I am trying to download only specific files from AWS. I have the list of file URLs. Using the CLI I can only download all files in a bucket using the --recursive command, but I only want to download the files in my list. Any ideas on how to do that?

推荐答案

由于文件中已包含s3网址(例如 file.list ),例如-

Since you have the s3 urls already in a file (say file.list), like -

s3://bucket/file1
s3://bucket/file2

您可以通过简单的方法将所有文件下载到当前工作目录中bash脚本-

You could download all the files to your current working directory with a simple bash script -

while read -r line;do aws s3 cp "$line" .;done < test.list

这篇关于使用CLI从AWS S3下载特定文件的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆