if (fileExt.ToUpper() == ".RAR")
{
string zpath = Server.MapPath("~/SendFileZIP/");
//不存在文件夾時創建文件夾
if (!Directory.Exists(zpath))
{
Directory.CreateDirectory(zpath);
}
//導入rar 壓縮文件時,清空SendFileZIP文件夾裡面所有的文件
DirectoryInfo clera = new DirectoryInfo(zpath);
deletefileOrDic(clera);
//解壓 上傳的rar文件
int count = RARToFileEmail(zpath, filePath);
//判斷解壓是否成功 解壓出來的文件數量是否大於
if (count > 0)
{
string[] strFiles = Directory.GetFiles(zpath);
string strfiel = "";
foreach (string item in strFiles)
{
DirectoryInfo dirtory = new DirectoryInfo(item);
//獲取不是文件夾時
if (!dirtory.Exists)
{
strfiel = strfiel + item.ToString();
break;
}
}
string zname = Path.GetFileName(strfiel).ToString();//獲取 解壓後的文件的名稱
//解壓後文件的名稱
string zFilePath = zpath + zname;
}
}