创建通过s3cmd一个文件夹(亚马逊S3)亚马逊、文件夹、s3cmd

2023-09-11 08:59:26 作者:偏爱孤身

我用s3cmd将文件上传到我的S3服务器。我的问题是,当服务器上的目录不存在上传失败。我怎么能告诉s3cmd创建文件夹,如果它不存在?我使用PHP。

I am using s3cmd to upload files to my S3 server. My problem is that when a directory on the server does not exist the upload fails. How can I tell s3cmd to create the folder if it does not exist? I am using PHP.

推荐答案

我相信你应该尝试像 s3cmd把file.jpg S3://bucket/folder/file.jpg

S3并没有目录的概念,整个文件夹/ file.jpg 是文件名。如果使用GUI工具什么的,你从文件夹中删除file.jpg,你很可能看到该文件夹​​没了。视觉重presentation在目录方面是为了方便用户。

S3 doesn't have the concept of directories, the whole folder/file.jpg is the file name. If using a GUI tool or something you delete the file.jpg from inside the folder, you will most probably see that the folder is gone too. The visual representation in terms of directories is for user convenience.