How to make Robocopy work

Posted on 2009-04-29
Medium Priority
Last Modified: 2012-05-06
I am trying to automate the process of copying my pictures each day from my laptop to a USB drive.  The USB drive will have several Gb of images on it and the laptop will have a few hunderd Mb.  I keep some images on my laptop to work on for weeks.  What I want to do is copy files from my laptop to my storage drive if they haven't been copied before.

The code below is what I am running.  I copied this from an exchange expert post but it only runs for a sec and no log file seems to be generated.  I don't know where to start, as it seems, according to the manual that something should have happend.
All of my disks are formated NTFS

Any thoughts?

SET _source=E:\All Music
SET _dest=F:\My Music
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree
SET _options=/R:1 /W:1 /LOG:MyLogfile.txt /NDL
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging
ROBOCOPY %_source% %_dest% %_what% %_options%

Open in new window

Question by:elentini
  • 2
  • 2
  • 2
LVL 47

Expert Comment

by:Donald Stewart
ID: 24266034
LVL 47

Expert Comment

by:Donald Stewart
ID: 24266044
LVL 31

Accepted Solution

Wayne Barron earned 500 total points
ID: 24266110
(This is taken from another question that I am helping in)

(Robocopy must be in the same folder as this script)
Copy this and save it as MyMusic.bat

robocopy "E:\Music" "F:|Music" /S /V /TS /FP /LOG+:"My Music.txt" /Z /R:10 /W:30

Please do the following.

Start | Programs | Accessories | System Tools | Schedule Tasks
[Add Scheduled Task]
Dialog opens.
Click [next]
Then click [Browse]
(Browse to the folder that has the .bat file is.)
Select the .bat file
Choose [Daily]
Then choose the time that you want it to start...
Example:  [5:30 PM]
Every Day
Start Date [4/25/2009]
Click [Next]
(Password for the users account)
Click [Next]
Then click [Finish]

This is tested, and this works.

And that will do it every day on key without any intervention from you from this day on.

Good Luck
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Assisted Solution

WumpusHunter earned 500 total points
ID: 24271449
I believe the issue in the original script is a lack of quotes around the src/dst. From the Robocopy docs:

To specify a directory or file name or path name that includes one or more spaces, you must enclose the entire file or path name in quotation marks. For example:
ROBOCOPY  \\sales\reports\Fiscal 97 C:\finance\Year End\sales /XF Budget 96*.*

Expert Comment

ID: 24271484
Sorry, the quotes got stripped from my robocopy documentation example. But you get the idea: try quotation marks around _source and _dest
LVL 31

Expert Comment

by:Wayne Barron
ID: 24271558
just noticed something on my script
robocopy "E:\Music" "F:|Music" /S /V /TS /FP /LOG+:"My Music.txt" /Z /R:10 /W:30
needs to be
robocopy "E:\Music" "F:\Music" /S /V /TS /FP /LOG+:"My Music.txt" /Z /R:10 /W:30


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are 2 things you must have in order to connect to the internet behind a router, The "Gateway IP" of the router, which is usually something like 192.168.xxx.1, I've seen routers with default values of:,,, …
Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question