1
我必須在亞馬遜S3中創建一個文件夾。現在必須在zip文件中轉換該文件夾。我已經使用DotNetZip Liberary轉換爲.zip文件。這裏是鏈接爲在亞馬遜S3中創建zip文件夾
http://dotnetzip.codeplex.com/wikipage?title=CS-Examples
public void ConvertToZip(string directoryToZip, string zipFileName)
{
try
{
using (client = DisposableAmazonClient())
{
var sourDir = new S3DirectoryInfo(client, bucket, directoryToZip);
var destDir = new S3DirectoryInfo(client, bucket, CCUrlHelper.BackupRootFolderPhysicalPath);
using (var zip = new ZipFile())
{
zip.AddDirectory(sourDir.FullName); // recurses subdirectories
zip.Save(Path.Combine(destDir.FullName, zipFileName));
}
}
logger.Fatal("Successfully converted to Zip.");
}
catch (Exception ex)
{
logger.Error("Error while converting to zip. Error : " + ex.Message);
}
}
當我運行它顯示的錯誤代碼「給出的路徑的格式不支持。」