2016-12-13 9 views
1

s3cmds3cmdではない)を使用してAmazon S3を管理すると、拡張子が.pdfのすべてのオブジェクトを選択してコンテンツタイプapplication/pdfを適用するにはどうすればよいですか?Amazon S3オブジェクトにコンテンツタイプを適用する方法

これは私がこれまでに思い付いたものです:

私はこのエラーを知った --debugパラメータ使用
aws s3 sync s3://${BUCKET_NAME} s3://${BUCKET_NAME} 
--dryrun 
--exclude '*' 
--include '*.pdf' 
--no-guess-mime-type 
--content-type application/pdf 

An error occurred (InvalidRequest) when calling the CopyObject operation: 
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

をオプションなしであなたのコマンドを試すことができますか?次に、オプションが1つずつ追加され、失敗したときを確認します。 – Sylwit

+0

@Sylwit私は--debugパラメータを使用し、エラーを見つけて質問を更新しました。 – bart

答えて

2

が直接メタデータを変更してみてください:

aws s3 sync s3://${BUCKET_NAME} s3://${BUCKET_NAME} 
--dryrun 
--exclude '*' 
--include '*.pdf' 
--no-guess-mime-type 
--metadata Content-Type=application/pdf 
関連する問題