Beatscribe
Beatscribe

Reputation: 503

Mass Copy Files On Amazon AWE with CLI

This is probably easy but it's really stumping me. I literally have about 9 hours experience with Amazon AWS and CLI.

I have a directory

    BDp-Archive/item/

on my S3 and I want to copy the text files in that directory into its sub directory called

    BDp-Archive/item/txt/

My attempted command was:

    aws s3 mv s3://Bdp-Archive/00009e98-3e0f-402e-9d12-7aec8e32b783/ s3://BDp-Archive/00009e98-3e0f-402e-9d12-7aec8e32b783/txt/ --include "*.txt"

This is throwing the error: A client error (NoSuchKey) occurred when calling the HeadObject operation: Key " 00009e98-3e0f-402e-9d12-7aec8e32b783" does not exist Completed 1 part(s) with ... file(s) remaining

Upvotes: 2

Views: 2670

Answers (3)

wrossmck
wrossmck

Reputation: 388

I needed to configure the region of my bucket (or specify it as part of the cli command

aws s3 cp --region <region> <from> <to>

Upvotes: 0

swv
swv

Reputation: 749

I think the problem is that you need to use the --recursive switch, since by default, the mv command only applies to a single object (much like the other commands - rm, sync, etc...). try:

aws s3 mv s3://Bdp-Archive/00009e98-3e0f-402e-9d12-7aec8e32b783/ s3://BDp-Archive/00009e98-3e0f-402e-9d12-7aec8e32b783/txt/ --include "*.txt" --recursive

Upvotes: 10

Julio Faerman
Julio Faerman

Reputation: 13501

You need to configure your access keys and secret key, try:

aws configure

For more options, see: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-installing-credentials

Upvotes: -1

Related Questions