For That Once in a Blue Moon when I Need That Program Called RoboCopy!

Hello everyone,

 

Untitled

Happy Friday! Let me start by saying I know many of you may not feel the need to keep this article. However, In that one Blue Moon, I guarantee you will need the information, because Robocopy has some odd scenarios.

I only call light to the thing we do with Robocopy: copy files. There are two scenarios for this. The target existed previously, or the target did not. Expressed another way, you are copying files or you are syncing files. It is a fine line indeed. So I tried to supply the basic commands below. If you are creating the target, then run the Create Target commands. If you are Syncing, then run the Sync Target Commands.

Create Target Commands

I know you likely already know how to use robocopy. But this little application can go wrong, if you make a mistake in your syntax. I decided to just share my basic commands with you. I generally just want a whole drive or a whole folder moved, with thread control.

The scope of my command is narrow, but it gets the job done in the fastest time, without a mistake.

the general form is

robocopy (source)(destination)(controls)

Here are solid examples of copying when the target does not yet exist.

In the above commands, the source is copied to the destination. You may add /SEC to any of these commands. This will copy and keep the security permissions. On a first time copy, the command will perform as expected.

Sync Target Commands
Now I am not getting into the insanity when the target exists. we all have too many things to do. If the Files have been copied before, to the destination, then you have to worry about files that have not changed from source to destination. My vote would be to delete all the target folders and recopy. If that does not work for you, then read on.

If you have an existing source and old target, meaning you are really syncing data, and not copying, there is another set of commands I will lay on you:

  • ROBOCOPY /Mir <Source> <Target>
  • ROBOCOPY /E /Copy:S /IS /IT <Source> <Target>

You have to run both commands! This is a work around, but it works. If you want to spend the hours of spinning up on robocopy, go ahead. I plan to just keep this article, with the two basic sets of commands, to get the work done.
I sourced my information from the following blog, which you can read and understand if you need detail:

Robocopy Mirror Switch Mirroring File Permissions

I hope this is helpful. I know we don’t do this too often, but I wanted to make sure I pointed to the Correct Article for this issue. This is likely going to remain a work around, based on the behavior of the command.

 

Have a great Early Spring weekend!

 

Louis Reeves

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s