Technology Toolbox

Your technology Sherpa for the Microsoft platform

Jeremy Jameson - Founder and Principal



Using Robocopy to Move Files and Folders

This post originally appeared on my MSDN blog:

Since I no longer work for Microsoft, I have copied it here in case that blog ever goes away.

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).


  1. # re: Using Robocopy to Move Files and Folders

    August 5, 2010 8:09 AM
    Linda Morgan

    i download robocopy and ran it. running well.

  2. # re: Using Robocopy to Move Files and Folders

    January 15, 2011 9:18 PM
    jerry johnson

    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. # re: Using Robocopy to Move Files and Folders

    January 16, 2011 6:29 PM
    Jeremy Jameson


    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. # re: Using Robocopy to Move Files and Folders

    April 4, 2011 2:47 PM
    Pavan Kumar Bandi

    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:\Windows\System32\Robocopy.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 ?

Add Comment

Optional, but recommended (especially if you have a Gravatar). Note that your email address will not appear with your comment.
If URL is specified, it will be included as a link with your name.

To prevent spam from being submitted, please select the following fruit: Strawberry

Please add 3 and 6 and type the answer here: