Exemple #1
0
 private void btnCopySimalr2_Click(object sender, EventArgs e)
 {
     if (dicSamilar.Count > 0)
     {
         DialogResult result = MessageBox.Show("你确定要将文件夹2的红色节点覆盖到文件夹1么?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (result == DialogResult.OK)
         {
             foreach (string key in dicSamilar.Keys)
             {
                 string curKey = key.Replace(txtPath2.Text, "");
                 if (!dicExclude2.ContainsKey(curKey))
                 {
                     string dirName = Path.GetDirectoryName(dicSamilar[key]) + "\\";
                     string cmd     = string.Format(" xcopy /E /Y {0} {1} ", key, dirName);
                     string output  = "";
                     CmdHelper.RunCmd(cmd, out output);
                 }
             }
             btnEnter1.PerformClick();
             btnEnter2.PerformClick();
         }
     }
 }
Exemple #2
0
 private void btnRoboCopy2_Click(object sender, EventArgs e)
 {
     if (exceptList2.Count > 0)
     {
         DialogResult result = MessageBox.Show("你确定要将文件夹2增量复制到文件夹1么?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (result == DialogResult.OK)
         {
             foreach (string key in exceptList2)
             {
                 if (!dicExclude2.ContainsKey(key))
                 {
                     string fileName   = txtPath2.Text + key;
                     string dirName    = Path.GetDirectoryName(fileName);
                     string targetName = dirName.Replace(txtPath2.Text, txtPath1.Text) + "\\";
                     string cmd        = string.Format(" xcopy /E /Y {0} {1} ", fileName, targetName);
                     string output     = "";
                     CmdHelper.RunCmd(cmd, out output);
                 }
             }
             btnEnter2.PerformClick();
             btnEnter1.PerformClick();
         }
     }
 }