[Fix] Match Unix `cp -r` nesting semantics in `copy_files` (#4081)
* fix: match Unix `cp -r` nesting semantics in `copy_files`
When copying a folder to an existing directory, Unix `cp -r` nests the
source folder inside it (e.g. `cp -r src dst` → `dst/src/...`). The
previous implementation always copied contents directly (→ `dst/...`),
which is rsync-like rather than cp-like.
Track `destination_exists_as_directory` separately from the
`destination_is_directory` flag (which also covers trailing-slash hints)
so that folder copies can distinguish "destination exists" from
"destination was requested as a directory". Nesting only applies when
the destination actually exists as a prefix in the bucket.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: simplify directory existence check with `any()`
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* quality
é
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>