Beispiel #1
0
 public static ObjectListing ListObjects(string maker)
 {
     ListObjectsRequest request = new ListObjectsRequest(_bucketName);
     request.Marker = maker;
     return _client.ListObjects(request);
 }
Beispiel #2
0
 /// <summary>
 /// 目录拷贝,暂时只支持一层文件夹
 /// </summary>
 /// <param name="sourceBucketName"></param>
 /// <param name="sourceDir"></param>
 /// <param name="destBucketName"></param>
 /// <param name="destDir"></param>
 public void CopyDirectory(string sourceBucketName, string sourceDir, string destBucketName, string destDir)
 {
     ListObjectsRequest listObjectRequest = new ListObjectsRequest(sourceBucketName);
     listObjectRequest.Prefix = sourceDir;
     listObjectRequest.Delimiter = @"/";
     ObjectListing listObject = _ossClient.ListObjects(listObjectRequest);
     foreach (var objSummary in listObject.ObjectSummaries)
     {
         CopyObjectRequest copyObjectRequest
             = new CopyObjectRequest(objSummary.BucketName, objSummary.Key
                 , destBucketName, destDir + objSummary.Key.Substring(sourceDir.Length));
         _ossClient.CopyObject(copyObjectRequest);
     }
 }