我已经在s3存储桶上传了文件。 但是由于我的错,s3cmd上传了s3:// backups / files / bkup14上的文件而不是s3:// backups / bkup14。 现在将s3:// backups / files / bkup14下的所有文件移动到s3:// backups / bkup14,我尝试了以下命令:
s3cmd mv --recursive s3://backups/files/bkup14 s3://backups/bkup14
但它给了我以下错误:
ERROR: S3 error: 400 (InvalidRequest): This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes.
我在这里做错了什么?谁能建议我?
答案 0 :(得分:2)
首先尝试SYNC桶(首先是干运行):
s3cmd sync s3://backups/files/bkup14/ s3://backups/bkup14/ --dry-run
s3cmd sync s3://backups/files/bkup14/ s3://backups/bkup14/
然后删除不再需要的文件夹:
s3cmd del --recursive s3://backups/files/bkup14 --dry-run
s3cmd del --recursive s3://backups/files/bkup14
AWS S3存储桶命名空间由系统的所有用户共享,因此,除非您非常幸运地抓住备份存储桶,否则您的#桶最有可能是其他产品。
以下是上述测试和证明的一个例子。
s3cmd sync s3://backups-stackoverflow-demo/files/bkup14/ s3://backups-stackoverflow-demo/bkup14/ --dry-run
Summary: 1 source files to copy, 0 files at destination to delete
Sync: s3://backups-stackoverflow-demo/files/bkup14/test.txt -> s3://backups-stackoverflow-demo/bkup14/test.txt
WARNING: Exitting now because of --dry-run
s3cmd sync s3://backups-stackoverflow-demo/files/bkup14/ s3://backups-stackoverflow-demo/bkup14/
Summary: 1 source files to copy, 0 files at destination to delete
File s3://backups-stackoverflow-demo/files/bkup14/test.txt copied to s3://backups-stackoverflow-demo/bkup14/test.txt
Done. Copied 1 files in 0.1 seconds, 16.72 files/s
s3cmd del --recursive s3://backups-stackoverflow-demo/files/bkup14 --dry-run
delete: s3://backups-stackoverflow-demo/files/bkup14/
delete: s3://backups-stackoverflow-demo/files/bkup14/test.txt
WARNING: Exitting now because of --dry-run
s3cmd del --recursive s3://backups-stackoverflow-demo/files/bkup14
File s3://backups-stackoverflow-demo/files/bkup14/ deleted
File s3://backups-stackoverflow-demo/files/bkup14/test.txt deleted