Using Robocopy to Move Files and Folders

I use Robocopy a lot, and it's been in my Toolbox for so long that I hardly remember using anything else. I was glad to see that it is now included out-of-the-box (starting with Vista), because I typically use it instead of Windows Explorer to move or copy files, since I prefer the way it reports the progress of the lengthy file operations.

Note that when you specify the "/S /MOV" or "/E /MOV" options (to recursively move files from one location to another), it may leave behind a bunch of empty folders depending on the contents of the source and what you specify to move.

Over a year ago I went through the rather painful effort of organizing my thousands of digital photos. During the process of moving thousands of files around to various folders, I ended up with lots of empty folders in my source folder structure.

As I discovered earlier this week, you can specify the /MOVE option (instead of /MOV) to move both the files and directories, and delete them from the source after they are copied.

Perhaps now my blog post from earlier this week about deleting empty folders makes a little more sense 😉

Sometimes I'm amazed at what I learn while blogging. I had just been in such the habit of using the /MOV option that I never gave it any thought (that is, until this week).

Comments (4)

  1. Linda Morgan says:

    i download robocopy and ran it. running well.

  2. jerry johnson says:

    i used it to move c:users to d:users, but what is the command to move your program files folder? I used: robocopy c:program files d:program files /mir /xj. But keep getting the error: bad command d:program. seems the 2 named folder is messing it up?

  3. @Jerry,

    It looks like you are missing the quotes around the folder names (since the paths contain spaces).

    Note, however, that I don't recommend moving your program files like this (since it is almost certain to break installed applications). If you need to move program files from one drive to another (presumably to free up space on the C: drive), then you should uninstall the corresponding applications and subsequently re-install them on the other drive.

  4. Pavan Kumar Bandi says:

    Hi Jeremy,

    I am using Robocopy from C#, but when trying to download a file with size > 300 MB, file is copied but Robocopy exe is not coming out of processing/ I am sending the piece of code:

    string loc_robocopy = @"C:WindowsSystem32Robocopy.exe";

    string arg_robocopy = srcFolder + "  " + AppSettings["OutputFilePath"] + "  " + outputFile;                        

    System.Diagnostics.Process proc_robocopy = new System.Diagnostics.Process();



                                proc_robocopy.StartInfo.Arguments = arg_robocopy;

                                proc_robocopy.StartInfo.FileName = loc_robocopy;

                                proc_robocopy.StartInfo.CreateNoWindow = false;

                                proc_robocopy.StartInfo.UseShellExecute = false;

                                proc_robocopy.StartInfo.RedirectStandardError = true;



                                string exitCodestr = "";

                                exitCodestr = proc_robocopy.ExitCode.ToString();


                            catch (Exception ex)


                               Console.WriteLine( ex.Message);


    Can you please tell me whether I need to mention any other parameter ?

Skip to main content