| 3397 | } |
| 3398 | |
| 3399 | Status S3FileSystem::Move(const std::string& src, const std::string& dest) { |
| 3400 | // XXX We don't implement moving directories as it would be too expensive: |
| 3401 | // one must copy all directory contents one by one (including object data), |
| 3402 | // then delete the original contents. |
| 3403 | |
| 3404 | ARROW_ASSIGN_OR_RAISE(auto src_path, S3Path::FromString(src)); |
| 3405 | RETURN_NOT_OK(ValidateFilePath(src_path)); |
| 3406 | ARROW_ASSIGN_OR_RAISE(auto dest_path, S3Path::FromString(dest)); |
| 3407 | RETURN_NOT_OK(ValidateFilePath(dest_path)); |
| 3408 | |
| 3409 | if (src_path == dest_path) { |
| 3410 | return Status::OK(); |
| 3411 | } |
| 3412 | RETURN_NOT_OK(impl_->CopyObject(src_path, dest_path)); |
| 3413 | RETURN_NOT_OK(impl_->DeleteObject(src_path.bucket, src_path.key)); |
| 3414 | // Source parent may be implicitly deleted if it became empty, recreate it |
| 3415 | return impl_->EnsureParentExists(src_path); |
| 3416 | } |
| 3417 | |
| 3418 | Status S3FileSystem::CopyFile(const std::string& src, const std::string& dest) { |
| 3419 | ARROW_ASSIGN_OR_RAISE(auto src_path, S3Path::FromString(src)); |