February 03, 2017

Simple Windows mirror directory backup with robocopy

Quick Tip

This is a simple Visual Basic script (Listing 1) that uses the windows robocoy command to perform a simple mirroring backup of a directory structure. Typically, use this to backup from your local machine to a network location just in case something happens to your hard drive.

NOTE This is a simple MIRROR copy backup strategy. There is no history maintained. If it’s obliterated during the backup, it’s gone!

Listing 1 - Single Statement File to String

Set WshShell = WScript.CreateObject ("WScript.Shell")
Return = WshShell.Run("cmd.exe /C robocopy C:\source X:\destination /MIR", 1)

1 comment:

  1. Umm.. Yes robocopy can be used to do this task but when I was using robocopy to do the same thing it often got stuck and keeps freezing in between, I dont know what happened that day. But the problem was persistent. So I switched to GS Richcopy 360, my friend told me about it. I really liked it and the performance was quite good too. Better than the rest atleast. If someone is having trouble then they can use this software. Hope this comment helps. Thanks!

    ReplyDelete