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);
}
}
当我运行它显示的错误代码“给出的路径的格式不支持。”