Jump to content
RESET Forums (homeservershow.com)

Robocopy Syntax


upsidedowncake

Recommended Posts

upsidedowncake

In addition to running the normal backups, I also wanted to set up a robocopy script that would take my most important information and transfer it to another drive, then to set it up in Scheduler to act as a backup that keeps the file structure the way it is shown now. I'll have two scripts for this, one that runs on my Client PC and one that runs on my Server. My biggest question is the syntax for copying folders from the PC to a drive on the server. I've attached the two scripts below, would greatly appreciate someone taking a look at them to see if they will do what I have tentatively outlined above, or if I'm off base a bit. The Script labeled PC will be the one running from my Client PC and the one labeled Server will run on my server. I'll make them .bat files once I know they'll run the way I'd like. Thanks for any help!

robocopy_pc.txt

robocopy_server.txt

Link to post
Share on other sites

Hi again. I use Robocopy a lot to do backup copies.

 

There are a few things right off I think you might want to change:

1) I don't use /mt. I have not found that it speeds things up at all.

2) I have never needed /z. RoboCopy is so reliable I don't feel it's needed.

3) I don't really recommend copying to/from hidden shares. I haven't needed to.

4) I think you need to use /r: and /w:. Without them, RoboCopy could run practically forever if it runs into an issue such as a busy or locked file.

5) I recommend using /np on any RoboCopy commands where you create log files. Otherwise the progress markers mess up the log file.

6) rather than .BAT I think you should name your files .CMD

Link to post
Share on other sites
upsidedowncake

Always helpful ikon, appreciated again!  Hopefully this one is a little quicker of a solution than the last haha.  Couple of questions:

 

1. Understood, I was following a tutorial that recommended it but didn't explain why besides "it might help".

3. Can you explain the hidden shares a little more?  One of the bigger questions I had in the syntax was the F$ that was recommended.  I wasn't sure how to denote the F drive on the server to point robocopy too.

4. Can you quickly explain what /r and /w do?

Link to post
Share on other sites

First, here's the RoboCopy file I use on my Win7 Desktop computer:

robocopy "d:\my documents" "\\WHS2011\documents\my documents" *.* /e /r:3 /w:2 /xd indexes %1 %2 /log:\\WHS2011\Backup\Logs\Win7desktop\RoboCopyWin7desktop.log

 

The %1 and %2 are optional parameter placeholders, in case I want to use them. For example, in Task Scheduler I use /np as a parameter to avoid all the 'noise' in the log files.

 

1. it's for multi-threading, something first introduced in the Win7 version of RC. While it might speed up copying somewhat, I'm worried it might also cause corruption or other issues. I'm not a fan.

3. since all the shares are visible on the server (e.g. \\upsidedowncake\documents) there should be no need to specify the drive letter. You should be able to copy to any name listed in the DashBoard Files and Folders window without using a drive letter.

4. /r: is how many times RC will Retry to copy a file if it finds one inaccessible. The default is to Retry 1 million times :). /w: is how many seconds to wait between Retries. The default is 30. So, if RC found a file that was busy, it would Retry copying that file 1 million times, waiting 30 seconds between Retries. That's a lonnnnnnng time ;)

Link to post
Share on other sites
upsidedowncake

1 million times???? That's the default, with a 30 second wait?  I'm sort of wondering who coded that in.  Thanks for all of the info, I think this should be enough to get it set up.  

Link to post
Share on other sites

If you type "RoboCopy /?" in a CMD window, you'll find this section part way down:

 

:::: Retry Options :::
               /R:n :: number of Retries on failed copies: default 1 million.
               /W:n :: Wait time between retries: default is 30 seconds.
               /REG :: Save /R:n and /W:n in the Registry as default settings.
               /TBD :: wait for sharenames To Be Defined (retry error 67).

Link to post
Share on other sites
upsidedowncake

Perfect, will check that out.  Still wondering who said 1 million would be a good number, but who am I to argue.  How often do you set up your robocopy to run in scheduler?  A weekly thing, nightly?  And if no changes have been made, will robocopy know not to run?

Link to post
Share on other sites

I run mine daily. If there are no changes RoboCopy will still run, but it will run very quickly. The only thing it will do is create the log file.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...