简体   繁体   English

将一个目录复制到同一Amazon S3存储桶中的另一个目录

[英]Copy one directory to another in same amazon s3 bucket

I am working with codeigniter. 我正在与Codeigniter合作。 For Amazon I have used its library. 对于亚马逊,我使用了它的库。

I need to rename a directory in an Amazon S3 bucket. 我需要在Amazon S3存储桶中重命名目录。

For that I used to copy one directory to another directory and the delete old directory after the copy, because I didn't get a direct way to rename the folder. 为此,我曾经将一个目录复制到另一个目录,并在复制后删除了旧目录,因为我没有直接的方法来重命名该文件夹。

I have used this code : 我使用了以下代码:

$ci->s3->copyObject(
$ci->config->item("BUCKET"),  //bucket name
$originalPath . $csrf,  //source folder
 $ci->config->item("BUCKET"), //bucket name
$originalPath . $productId) //destination folder

But this is not working to copy one directory to another. 但这无法一个目录复制到另一个目录。

Please show me the correct way to rename a folder. 请告诉我重命名文件夹的正确方法。

You can try this to move files from one folder to an existing other with the awscli : 您可以尝试使用awscli 文件从一个文件夹移动到现有文件夹:

aws s3 mv s3://your_bucket/old_folder/ s3://your_bucket/new_folder/ --recursive

If you want to copy the files change mv to cp . 如果要复制文件,请将mv更改为cp

Please be aware that your old_folder will not be deleted. 请注意,您的old_folder不会被删除。 It just will be empty after all files have been moved. 移动完所有文件后,它将为空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自动将文件从一个存储桶移动到另一个存储桶并在Amazon S3中公开 - Automatically move file from one bucket to another bucket and make public in Amazon S3 使用php将文件从一个文件夹复制到Amazon S3存储桶中的另一个文件夹 - Copying files from one folder to another in Amazon S3 bucket using php 使用 PHP 将 object 从一个 Amazon S3 存储桶复制到另一个存储桶 - Copying an object from one Amazon S3 bucket to another using PHP 在Amazon S3 Bucket(PHP)内的整个目录中分配权限 - Assign permission in an entire directory inside Amazon S3 Bucket (PHP) AWS S3 使用不同的凭证将 object 从一个存储桶复制到另一个存储桶 - AWS S3 copy object from one bucket to another with different credentials 在 AWS S3 中将多个文件从一个存储桶复制到另一个存储桶的最佳方法是什么? - What is the best way to copy multiple files from one bucket to another in AWS S3? S3 Bucket Amazon问题 - S3 Bucket Amazon issue Amazon S3存储桶上传 - Amazon S3 bucket upload 亚马逊 s3 将桶与桶策略 - Amazon s3 put bucket with bucket policy 如何在PHP中将所有文件(不使用副本)和文件夹从一个文件夹移动到S3存储桶的另一个文件夹,不能使用复制功能 - How to move all files (without using copy) and folder from one folder to another of S3 bucket in PHP ,Cannot use copy function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM