如何使用Objective-C的建立在Amazon S3上的文件夹 [英] How to create folder on Amazon S3 using objective-c

查看:186
本文介绍了如何使用Objective-C的建立在Amazon S3上的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可能已经问过(至少一个问题在Python ),但我仍然在努力得到这个权利。我比较我的本地文件夹的结构和内容与我已存储在我的亚马逊S3存储桶。不是已有的在S3上,但这些目录在本地发现,要在我的S3存储桶创建。看来,亚马逊的S3没有一个文件夹的的概念,而是一个文件夹标识如大小0.我的问题是一个空文件,我怎么能轻松地把一个空文件(名称为correspoding文件夹名称)在S3上创建的Objective-C的一个文件夹(我用ASIHTTP我get和put事件) ?我想通过复制一个新的文件,以一个非已有的文件夹明确而不能创建目录隐。在此我AP preciate你的帮助。

解决方案
  

看来,亚马逊的S3没有一个文件夹的概念,而是一个文件夹被确定为大小为0的空文件

/ 字符经常被用来作为分隔符,当按键被用作路径名。要创建一个名为在父文件夹的文件夹,创建一个键名为 /富/酒吧/

亚马逊现在有一个 AWS SDK的目标C 。该<一href="http://docs.amazonwebservices.com/AWSiOSSDK/latest/class_s3_put_object_request.html"><$c$c>S3PutObjectRequest类有方法<一href="http://docs.amazonwebservices.com/AWSiOSSDK/latest/class_s3_put_object_request.html#a0876d3a90864ceb6f71a3f49e9d40cde"><$c$c>-initWithKey:inBucket:.

I know this is a question that may have been asked before (at least in Python), but I am still struggling to get this right. I compare my local folder structure and content with what I have stored in my Amazon S3 bucket. The directories not exisiting on S3, but which are found locally, are to be created in my S3 bucket. It seems that Amazon S3 does not have the concept of a folder, but rather a folder is identified as an empty file of size 0. My question is, how can I easily create a folder in objective-c by putting an empty file (with name correspoding to the folder name) on S3 (I use ASIHTTP for my get and put events)? I want to create the directory explicitly and not implicitly by copying a new file to a non-exisiting folder. I appreciate your help on this.

解决方案

It seems that Amazon S3 does not have the concept of a folder, but rather a folder is identified as an empty file of size 0

The / character is often used as a delimiter, when keys are used as pathnames. To make a folder called bar in the parent folder foo, create a key with the name /foo/bar/.

Amazon now has an AWS SDK for Objective C. The S3PutObjectRequest class has the method -initWithKey:inBucket:.

这篇关于如何使用Objective-C的建立在Amazon S3上的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆