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

余生长醉 提交于 2019-12-22 04:38:16

问题


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


回答1:


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



回答2:


Probably your file is quite big, try increasing socket_timeout s3cmd configuration setting

http://sumanrs.wordpress.com/2013/03/19/s3cmd-timeout-problems-moving-large-files-on-s3-250mb/




回答3:


Remove the ' signs. Your code should be:

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

Also try what are the permissions of your bucket - for your username you should have all the permissions.

Also try to connect CloudFront to your bucket. I know it doesn' make sense but I have similar problem to bucket which do not have cloudfront instance clonnected to it.



来源:https://stackoverflow.com/questions/11049354/can-i-move-an-object-into-a-folder-inside-an-s3-bucket-using-the-s3cmd-mv-comm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!