【问题标题】:uploading all files of a certain extension type上传特定扩展类型的所有文件
【发布时间】:2014-07-16 17:17:25
【问题描述】:

我正在尝试使用 AWS CLI 从 Windows server 2008 命令行将所有 .flv 类型的文件上传到 S3 存储桶。

我这样做:

aws s3 sync . s3://MyBucket --exclude '*.png'

它开始上传 .png 文件。

我正在尝试关注documentation,它提供了一个示例,内容如下:

Local directory contains 3 files:
MyFile1.txt
MyFile2.rtf
MyFile88.txt
'''
aws s3 sync . s3://MyBucket/MyFolder --exclude '*.txt'
upload: MyFile2.rtf to s3://MyBucket/MyFolder/MyFile2.rtf

那我做错了什么?

【问题讨论】:

标签: amazon-web-services amazon-s3 aws-cli


【解决方案1】:

用途:

aws s3 sync . s3://MyBucket/ --exclude "*" --include "*.flv"

它排除所有文件,然后包括 .flv 文件。参数的顺序很重要。

你也可以使用:

aws s3 cp . s3://MyBucket/ --recursive --exclude "*" --include "*.flv"

不同之处在于sync 不会重新复制目标中已存在的文件。

【讨论】:

  • 注意:如果文件过期,sync 将重新复制。例如,如果您对本地文件进行了更改并进行了同步,即使目标存储桶中已存在同名文件,该文件也会被上传。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-01
  • 1970-01-01
  • 2016-07-26
  • 2019-06-14
相关资源
最近更新 更多