Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon s3 用s3cmd覆盖文件_Amazon S3_S3cmd - Fatal编程技术网

Amazon s3 用s3cmd覆盖文件

Amazon s3 用s3cmd覆盖文件,amazon-s3,s3cmd,Amazon S3,S3cmd,我尝试使用s3cmd将文件上传到我的S3存储桶。工作正常,但已经存在的文件不会被覆盖,而是保存为新文件,如“filename-1.ext” 我已经找到了答案 -f, --force (Force overwrite and other dangerous operations.) 命令并尝试 s3cmd put ~/Desktop/filename.ext s3://mybucket -f 但文件仍保存为新文件,不会被覆盖。 有人知道吗?谢谢你的帮助 现在建议使用 它有一个aws s3 c

我尝试使用s3cmd将文件上传到我的S3存储桶。工作正常,但已经存在的文件不会被覆盖,而是保存为新文件,如“filename-1.ext”

我已经找到了答案

-f, --force (Force overwrite and other dangerous operations.)
命令并尝试

s3cmd put ~/Desktop/filename.ext  s3://mybucket -f
但文件仍保存为新文件,不会被覆盖。
有人知道吗?谢谢你的帮助

现在建议使用


它有一个
aws s3 cp
命令,始终保留请求的名称。

首先删除现有文件:
s3cmd del s3://bucket/file
,然后放入新文件。

您可以使用。它是用Golang编写的&在开源Apache许可下可用。它适用于Mac、Linux、Windows和FreeBSD。您可以使用
mc cp
命令来实现您的需求

mcgnu/Linux下载 为AmazonS3配置mc
  • 替换为您的访问/密钥
  • 默认情况下,mc使用AmazonS3的签名版本4
  • mys3是minio客户端的amazons3别名
将对象名
myfile.txt
覆盖到Amazon S3 bucket name
mybucket

./mc cp myfile.txt mys3/mybucket
希望能有帮助


免责声明:我为

工作,我从未见过s3cmd使用您描述的新文件名存储对象。你用的是什么版本?
$ mc config host add mys3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
./mc cp myfile.txt mys3/mybucket