Solved

Command Line To Backup Drives

Hello everyone. I have a file server at home with a 2tb drive filled with movies, music and picture. It's shared with other devices in my network.

What I would like to do is purchase 2 4TB external drives. Only one external drive will be attached to my file server at one time. What I would like to do it to create a batch file that runs from the scheduler, 3am. When the file is executed, it will take the contents of the D: (internal) drive and duplicate everything to the Z: (external). However, once I have a complete initial backup of the D:, I only want new files or recently edited files to be backed up. Every other week, I would like to use the other external drive and swap them and the scheduler runs every morning.

Basically I want a copy on an external drive that I will leave in my car or the office. In case a catastrophe happens. I don't want cloud storage and I don't really want to spend money on a backup software.

Would something like this work?
xcopy "d:\*" "z:\" /y /f /e
9 answers Last reply Best Answer
More about command line backup drives
  1. What operating system is the file server running?
  2. Rogue Leader said:
    What operating system is the file server running?


    Win7 64bit.
    It's not really a "server" but I'm just using it to store files.
    i3 2120
    8GB ddr3
  3. Full drive image (or Full+Differential/Incremental)
    Macrium Reflect Free

    Individual folders
    SyncBackFree
    FreeFileSync


    Any of those will do it on demand, or unattended on whatever schedule you set.
  4. robocopy and a scheduled task. You can have it only backup new or modified files and not waste time overwriting files that have already been backed up. You can also set up exclusion lists and all kinds of neat things.

    There are robocopy GUIs like robocop robocopy that can make it easier to set up.
  5. Agreed with USAFRet.

    Those software titles offer better control and much easier to use for scheduled backups then a batch file.
  6. Eximo said:
    robocopy and a scheduled task. You can have it only backup new or modified files and not waste time overwriting files that have already been backed up. You can also set up exclusion lists and all kinds of neat things.

    There are robocopy GUIs like robocop robocopy that can make it easier to set up.


    Robocopy doesn't seem to be working. Says something about a 32-bit vs 64-bit error.

    Xcopy does work. However it's picking up everything on 2nd and 3rd batches when it should only pick up incrementals. I have a feeling I'm entering the wrong switch.
  7. So far this command works when manually entered:

    xcopy *.* z:\Backups\ /y /f /e /c /h /d

    When I write it to an exe or bat file is when I encounter problems.
    I'm getting closer to the solution I can taste it :d

    Thank you guys for those software solutions. I am very cautious about software specially free ones. There's always a "catch".

    If I can write the command to a file and attach that file to a schedule then I'm golden. So close yet so far.
  8. Being a looooong time user of those 3 specific applications, I've seen no 'catch'.
    Zero, zip, nada, none.
  9. Best answer
    Robocopy to batch file and run it with Task Scheduler:

    robocopy source destination /options

    Example:
    "robocopy c:\ d:\ /mir /xx"
    - mirrors all files from c:\ to d:\
    - if ran after some time again, only new and changed files are copied
    - /xx option tells not to remove deleted files from d:\

    "robocopy c:\ d:\ /mir" would keep exact copy of c:\ to d:\ i.e. deleted files are deleted also from d:\

    With a batch file you want to use also the /R and /W options (retry and wait).
Ask a new question