Im try to make a program who take two folders and add to archive with ZipFile.
For now I taka one folder and make archive in the directory, and take second folder and make to archive in the directory.
But, I want to take this two folders and make it to archive ?
My code is:
string Info = "";
string startPath = @"D:\dosfiles\ValPoch\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD";
string zipPath = @"D:\dosfiles\ValPoch\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip";
if (File.Exists(zipPath))
{
File.Delete(zipPath);
ZipFile.CreateFromDirectory(startPath, zipPath);
//MessageBox.Show("Вашият архив е създаден в папка D:\\dosfiles\\ValPoch\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip");
Info += "Вашият архив е създаден в папка D:\\dosfiles\\ValPoch\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip" + Environment.NewLine;
}
else
{
ZipFile.CreateFromDirectory(startPath, zipPath);
//MessageBox.Show("Вашият архив е създаден в папка D:\\dosfiles\\ValPoch\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip");
Info += "Вашият архив е създаден в папка D:\\dosfiles\\ValPoch\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip" + Environment.NewLine;
}
string startPath1 = @"D:\dosfiles\SVK\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD";
string zipPath1 = @"D:\dosfiles\SVK\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip";
if (File.Exists(zipPath1))
{
File.Delete(zipPath1);
ZipFile.CreateFromDirectory(startPath1, zipPath1);
//MessageBox.Show("Вашият архив е създаден в папка D:\\dosfiles\\SVK\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip");
Info += "Вашият архив е създаден в папка D:\\dosfiles\\SVK\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip";
}
else
{
ZipFile.CreateFromDirectory(startPath1, zipPath1);
//MessageBox.Show("Вашият архив е създаден в папка D:\\dosfiles\\SVK\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip");
Info += "Вашият архив е създаден в папка D:\\dosfiles\\SVK\\" + comboBox1.SelectedItem.ToString() + "_" + comboBox2.SelectedItem.ToString() + ".SVD.zip";
}
if (Info != "")
{
MessageBox.Show(Info);
}