简体   繁体   English

如何将S3数据上移到一个分区级别?

[英]How to move S3 data to one partition level up?

Let's say I have a table in the path 假设我在路径中有一张桌子

s3:bucketname/tablename/month/day/deviceid

I want to move all files to s3:bucketname/tablename/month/day/ . 我想将所有文件移动到s3:bucketname/tablename/month/day/ In other words, I want to ignore the last partition. 换句话说,我想忽略最后一个分区。

Note that there are already data in the path s3:bucketname/tablename/month/day/ 请注意,路径s3:bucketname/tablename/month/day/中已经有数据s3:bucketname/tablename/month/day/

Can I use aws s3 to achieve this? 我可以使用aws s3来实现吗?

I have more than 100K files so I cannot do this manually. 我有超过10万个文件,因此无法手动执行。

I believe you can use the AWS console on the web . 我相信您可以在Web上使用AWS控制台 Open the source folder ( deviceid ), select all its contents by the checkbox to the left on Name. 打开源文件夹( deviceid ),通过名称左侧的复选框选择其所有内容。

您可以单击选择所有文件

Then select Actions → Copy. 然后选择操作→复制。

Open the destination folder ( day ), click Actions → Paste. 打开目标文件夹( day ),单击操作→粘贴。 Confirm the operation. 确认操作。

Once the operation has finished successfully, you can delete the source folder with all its contents. 操作成功完成后,您可以删除源文件夹及其所有内容。

You can do this in 2 ways. 您可以通过2种方式执行此操作。

If you are not familiar with the aws cli, then go to the console, select all the files, cut and paste on the desired directory. 如果您不熟悉aws cli,请转到控制台,选择所有文件,然后将其剪切并粘贴到所需目录中。 However, this is very time consuming and inefficient task. 但是,这是非常耗时且效率低下的任务。

I recommend the aws cli for S3. 我推荐S3的aws cli。 You can find some sample commands here . 您可以在此处找到一些示例命令。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM