Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I move an object into a 'folder' inside an S3 bucket using the s3cmd mv command?

I have the s3cmd command line tool for linux installed. It works fine to put files in a bucket. However, I want to move a file into a 'folder'. I know that folders aren't natively supported by S3, but my Cyberduck GUI tool converts them nicely for me to view my backups.

For instance, I have a file in the root of the bucket, called 'test.mov' that I want to move to the 'idea' folder. I am trying this:

s3cmd mv s3://mybucket/test.mov s3://mybucket/idea/test.mov

but I get strange errors like:

WARNING: Retrying failed request: /idea/test.mov (timed out)
WARNING: Waiting 3 sec...

I also tried quotes, but that didn't help either:

s3cmd mv 's3://mybucket/test.mov' 's3://mybucket/idea/test.mov'

Neither did just the folder name

s3cmd mv 's3://mybucket/test.mov' 's3://mybucket/idea/'

Is there a way within having to delete and reput this 3GB file?

Update: Just FYI, I can put new files directly into a folder like this:

s3cmd put test2.mov s3://mybucket/idea/test2.mov

But still don't know how to move them around....

like image 362
Nic Cottrell Avatar asked Jun 15 '12 10:06

Nic Cottrell


People also ask

How do I move objects in S3 bucket?

To move objectsNavigate to the Amazon S3 bucket or folder that contains the objects that you want to move. Select the check box to the left of the names of the objects that you want to move. Choose Actions and choose Move from the list of options that appears.

Can S3 object be a folder?

Amazon S3 is a highly-scalable object storage system. Amazon S3 can contain any number of objects (files), and those objects can be organized into “folders”.

What is S3cmd used for?

What is S3cmd. S3cmd ( s3cmd ) is a free command line tool and client for uploading, retrieving and managing data in Amazon S3 and other cloud storage service providers that use the S3 protocol, such as Google Cloud Storage or DreamHost DreamObjects.

Can we create folder inside S3 bucket?

When you use the Amazon S3 console to create a folder, Amazon S3 creates a 0-byte object with a key that's set to the folder name that you provided. For example, if you create a folder named photos in your bucket, the Amazon S3 console creates a 0-byte object with the key photos/ .


1 Answers

To move/copy from one bucket to another or the same bucket I use s3cmd tool and works fine. For instance:

s3cmd cp --r s3://bucket1/directory1 s3://bucket2/directory1
s3cmd mv --recursive s3://bucket1/directory1 s3://bucket2/directory1
like image 96
sgimeno Avatar answered Oct 04 '22 02:10

sgimeno