AWS S3 SDK获取文件的文件夹,而不是 [英] AWS S3 SDK Get the folder instead of a file

查看:269
本文介绍了AWS S3 SDK获取文件的文件夹,而不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面codeS可以得到1单个文件从AWS 3,但是,怎么样的一个文件夹?

  VAR _key:INT = Account.lessons [dl_i] .ID;
VAR DEST:字符串= Conf.Dir + _key;
VAR要求:GetObjectRequest =新
。GetObjectRequest()WithBucketName(Conf.bucketName).WithKey(_key +);
VAR回应:GetObjectResponse = client.GetObject(要求);
response.WriteResponseStreamToFile(DEST);
 

解决方案

有没有这样的东西,在亚马逊S3文件夹。这是一个平的文件系统。你可以得到更接近于文件夹是增加prefixes像富/酒吧/ FILENAME.TXT 到您的文件名。 尽管几个S3工具会告诉你的东西,如果他们被包含的文件夹里面,这个概念并不在S3上存在。

请参阅此相关的主题: Amazon S3的文件夹的问题

Below codes can get 1 single file from AWS 3 but, what about a folder?

var _key:int=Account.lessons[dl_i].id;
var dest:String =  Conf.Dir+_key;
var request:GetObjectRequest  = new
GetObjectRequest().WithBucketName(Conf.bucketName).WithKey(_key+"");
var response:GetObjectResponse  = client.GetObject(request);
response.WriteResponseStreamToFile(dest);

解决方案

There is no such stuff as folders in Amazon S3. It is a "flat" file system. The closer you can get to folders is adding prefixes like foo/bar/filename.txt to your file names. Even though several S3 tools will show you stuff as if they were contained inside folders, this concept does not exist on S3.

Please see this related thread: Amazon s3 Folders Problem

这篇关于AWS S3 SDK获取文件的文件夹,而不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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