File copy using robo copy and process

前端 未结 5 1667
情歌与酒
情歌与酒 2021-02-19 23:30

I am creating a File copy program which will copy large number of files(~100,000) with size ~50 KB using ROBOCOPY command.

For each file, I am creating a new process an

5条回答
  •  面向向阳花
    2021-02-19 23:59

    Process p = new Process();
    p.StartInfo.Arguments = string.Format("/C Robocopy /S {0} {1}", "C:\\source", "C:\\destination");
    p.StartInfo.FileName = "CMD.EXE";
    p.StartInfo.CreateNoWindow = true;
    p.StartInfo.UseShellExecute = false;
    p.Start();
    p.WaitForExit(); 
    
    /C Robocopy -> this is a command to run robocopy
    /S -> This will help to copy sub folders as well as Files
    

提交回复
热议问题