How to make Robocopy work

Posted on 2009-04-29
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
    LVL 47

    Expert Comment

    LVL 47

    Expert Comment

    LVL 30

    Accepted Solution

    (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
    LVL 2

    Assisted Solution

    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*.*
    LVL 2

    Expert Comment

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

    Expert Comment

    by:Wayne Barron
    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

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    If you build your web application in Visual Studio you'll get at least a few binaries, or .DLL, files in your bin folder. However, there is more compiling to be done. Normally this would happen when an ASP.NET resource within the web site is request…
    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, I've seen routers with default values of:,,, …
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now