morfys
morfys

Reputation: 2415

s3 sync directory, including the directory itself

I'm currently running the aws s3 command:

aws s3 sync 'A' s3://my-bucket

which syncs all the contents of directory A to the bucket but does not include the directory A itself.

E.g., if A contains A-subdir, then the bucket will contain A-subdir, not A with A-subdir nested in it.

Is there a way to make s3 sync include the directory A and its contents?

Upvotes: 3

Views: 1780

Answers (1)

Nir Alfasi
Nir Alfasi

Reputation: 53535

Unless you specify the object path you want to have under the bucket - it will default to sync into the "root" of the bucket.

Try instead to specify where you want it to sync:

aws s3 sync A s3://my-bucket/A
                            ^^^ the change is here

Upvotes: 3

Related Questions