brightDot
brightDot

Reputation: 339

cp command with Key for each file

I have a folder structure like

Using cp command I am able to copy the local structure to the S3 bucket. But I have a server configured to access files like this in a bucket

Test2/Test2-1.jpg, because I have copied it using cp command from a local directory, I can't set the key to Test2/Test2-1.jpg.

Before I was copying each and every file manually through Boto API by setting Key manually. That worked but its very long process.

Is there any way I can achieve this using cp command?

EDIT:

The actual issue causing the problem was content-encoding gzip. I was passing this encoding for not gz file. Due to that, the file is not stored properly and accessible.

Upvotes: 0

Views: 237

Answers (1)

cementblocks
cementblocks

Reputation: 4606

If you are in a directory with Test2-1.jpg in it you can copy it to yourbucket/Test2/Test2-1.jpg by running

  aws s3 cp ./Test2-1.jpg s3://yourbucket/Test2/Test2-1.jpg

You can copy an entire directory by using the sync command

  aws s3 sync . s3://yourbucket/Test2/

Upvotes: 1

Related Questions