c# - 有 "key is a directory name"异常

标签 c# amazon-web-services amazon-s3

S3DirectoryInfo dir= new S3DirectoryInfo(client, "bucketname", "sampledir/sample");
test.Create();
var files = dir.GetFiles();

所以使用 dir.GetFiles(),我无法获取目录中的文件。 我该如何解决这个问题????

最佳答案

使用下面的代码代替上面的代码,它将起作用。变化是尾部斜线。

S3DirectoryInfo dir= new S3DirectoryInfo(client, "bucketname","sampledir\sample");
    test.Create();
    var files = dir.GetFiles();

关于c# - 有 "key is a directory name"异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37704306/

相关文章:

json - DynamoDB JSON 还是标准 JSON?

node.js - 应用程序端加入 Node 的 ORM?

amazon-web-services - 在没有公共(public) IP 的情况下设置 Amazon Elastic Beanstalk 应用程序

python - 从 boto3 检索 S3 存储桶中的子文件夹名称

amazon-s3 - 我收到 s3 错误 : An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied

c# - 这个API可以改进吗?

c# - 具有查询字符串参数的站点中的 SEO 关键字

python - Pyspark S3 错误 : java. lang.NoClassDefFoundError: com/amazonaws/services/s3/model/MultiObjectDeleteException

c# - 在 list 中发现意外元素 <uses-library>

c# - 我可以对齐 C# 气球提示中的文本吗?