亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將文件從Amazon EC2的S3存儲桶下載到Windows 7中的本地驅動器

將文件從Amazon EC2的S3存儲桶下載到Windows 7中的本地驅動器

函數式編程 2021-05-30 16:02:07
我正在嘗試通過boto3和python3腳本從Amazon ec2的s3存儲桶中下載所有示例文件到本地硬盤。這是腳本。#downloading files from s3import boto3import sysimport osimport argparseimport threadingfrom botocore.client import Configinstance_id = "i-03e7f6391a0f523ee"action = 'ON'ec2 = boto3.client('ec2')s3=boto3.resource('s3')for bucket in s3.buckets.all():    print(bucket.name)my_bucket=s3.Bucket('tkbucket32')print("listing all files in bucket")for s3_file in my_bucket.objects.all():    print(s3_file.key)s3.meta.client.download_file('tkbucket32', 'hello.txt', '/tmp/hello.txt')當前存儲桶中有以下文件你好.txt myhomepage.html現在我希望它們被下載到D:\folder1\folder2\folder3我在 Windows 7 中運行腳本。我的問題是這一行s3.meta.client.download_file('tkbucket32', 'hello.txt', '/tmp/hello.txt')我在哪里指定要下載這些文件的本地硬盤驅動器的路徑?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 234 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號