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

Nic Cottrell picture Nic Cottrell · Jun 15, 2012 · Viewed 18.9k times · Source

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....

Answer

sgimeno picture sgimeno · Feb 27, 2013

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