Description
My apologies if this has been discussed before; I tried my best to search for it (difficult) and read through the relevant labels.
Given a directory with multiple things in it:
/tmp
├── aaa
├── foo
├── bar
├── bbb
├── ccc
I'd like to copy one of those directories to s3, the equivalent of cp -r /tmp/aaa /my-bucket/
.
Unfortunately, both aws s3 cp
and aws s3 sync
act more like cp -r /tmp/aaa/* /my-bucket/
- that is, they skip the containing directory and splat all its containing files directly into the root of the bucket. Running either
[$]> aws s3 sync /tmp/aaa s3://my-bucket
or
[$]> aws s3 cp /tmp/aaa s3://my-bucket --recursive
will result in the contents of aaa
residing in s3:
my-bucket:
├── foo
├── bar
(For my particular purposes, I don't care about synchronization, but was just hoping that perhaps sync
would act as I hoped. Existing documentation aside, I would expect aws s3 cp
to act like cp
and aws s3 sync
to act like rsync
, in regards to directories, at least as far as can happen with s3's lack of actual directories.)
This is annoying, because it forces me to basename
the directory and tack that on to the end of the bucket. It's also surprising; not only does it not act like common *nix utilities, but aws s3 sync help
implies a different behavior via its use of .
as a source directory for all examples.