Command Line To Backup Drives

Jay Santos

Reputable
Apr 20, 2015
294
0
4,810
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
 
Solution
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).
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.
 
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.
 
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).
 
Solution