The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    I *LOVE* Robocopy... sync and backup

    Discussion in 'Windows OS and Software' started by HTWingNut, Mar 12, 2012.

  1. HTWingNut

    HTWingNut Potato

    Reputations:
    21,580
    Messages:
    35,370
    Likes Received:
    9,877
    Trophy Points:
    931
    Wow. After spending lots of time reconfiguring my Windows Home Server 2011 and figuring a way to backup my server to my other WHS (although v1), all the existing sync files failed me in some way or another.

    To the rescue comes Robocopy. A very robust command line utility included with Server and Windows 7. It allows for file backups and syncing, create logs, and fully customizable. Works like a charm. I suggest anyone interested in backing up and syncing files to give it a shot if command line flags don't bother you.

    There is a very good web page with detailed information on using robocopy here: Robocopy

    I automate my entire WHS backup using task scheduler and a script that incorporates robocopy. Now it's all hands off, automated, and robust. I also use it to copy my steam games folder over to my server time and again. This way I can just copy the game folder over from my server rather than download again from Steam. A lot more quick and doesn't go against my internet GB cap.
     
  2. saturnotaku

    saturnotaku Notebook Nobel Laureate

    Reputations:
    4,879
    Messages:
    8,923
    Likes Received:
    4,701
    Trophy Points:
    431
    I've been partial to MS SyncToy myself. Might not be as robust as Robocopy, but it gets the job done and no potentially messy command-line stuff to worry about.
     
  3. HTWingNut

    HTWingNut Potato

    Reputations:
    21,580
    Messages:
    35,370
    Likes Received:
    9,877
    Trophy Points:
    931
    I tried synctoy but it chokes with large volumes of data. It kept hanging on empty folders or files that were deleted previously. SyncToy is simple and easy to use, and is good for backing up / syncing a small number of files to an external hard drive or something. But for server to server multi-terabyte setup, robocopy is the way to go.
     
  4. toronto

    toronto Notebook Deity

    Reputations:
    127
    Messages:
    714
    Likes Received:
    6
    Trophy Points:
    31
    One of the advantages of Robocopy on Win7 (and, IIRC, the Vista version) is that it's multi-threaded. That won't make a difference on a first copy, but subsequent copies to update just the files/folders that have changed are much faster than would be with single-threaded apps like SyncToy.

    One problem I'm having with Robocopy is that backing up an entire partition to an external drive results in the backup folder being a system-type folder, with its protections and limitations. It contains Recycler and recycle bin, system volume information, etc.

    I use the /XA:SH switch to exclude the hidden system files, yet still this occurs, and I haven't found a solution on Robocopy resource sites (other than, perhaps, to stop backing up an entire partition, which would be an annoying limitation for me).
     
  5. BlackLion

    BlackLion Notebook Consultant

    Reputations:
    117
    Messages:
    166
    Likes Received:
    1
    Trophy Points:
    30
    @toronto - you can explicitly exclude the folders you don't want to appear in the backup like so: /XD "$RECYCLE.BIN" "System Volume Information"

    Furthermore, in my BAT file I also call ATTRIB -S -H %dest_dir% right after ROBOCOPY to remove the system and hidden attributes from the backup folder.
     
  6. toronto

    toronto Notebook Deity

    Reputations:
    127
    Messages:
    714
    Likes Received:
    6
    Trophy Points:
    31
    Thanks. I knew I could identify specific folders to exclude, but I thought that should be unnecessary when using the /XA:SH switch. I don't understand why such folders aren't excluded with that switch.

    That system attribute removal is a good idea, thanks.
     
  7. HTWingNut

    HTWingNut Potato

    Reputations:
    21,580
    Messages:
    35,370
    Likes Received:
    9,877
    Trophy Points:
    931
    Great to know! I'm glad I happened upon this great utility.
     
  8. toronto

    toronto Notebook Deity

    Reputations:
    127
    Messages:
    714
    Likes Received:
    6
    Trophy Points:
    31
    Is there a way to make that command recursive, so it applies to all files and folders withing a folder?

    I used
    ATTRIB -S -H "G:\Backup Files\Data_partition"
    But it applied only to that specified folder "Data_partition" and not to all the files and folders it contains.
     
  9. BlackLion

    BlackLion Notebook Consultant

    Reputations:
    117
    Messages:
    166
    Likes Received:
    1
    Trophy Points:
    30
    Try ATTRIB -S -H "G:\Backup Files\Data_partition\*.*" /S /D
     
  10. toronto

    toronto Notebook Deity

    Reputations:
    127
    Messages:
    714
    Likes Received:
    6
    Trophy Points:
    31
    Thanks. I think that removed the system attribute.

    But, the folder still contains files with "hidden" attribute and "Read only" attribute. I want to remove those attributes, as currently I cannot view that backup folder when logged in as a normal user due i assume to those attributes.
     
  11. BlackLion

    BlackLion Notebook Consultant

    Reputations:
    117
    Messages:
    166
    Likes Received:
    1
    Trophy Points:
    30
    Odd because it should also remove the hidden attributes. Have you tried to specify -R also (e.g. ATTRIB -S -H -R "G:\Backup Files\Data_partition\*.*" /S /D). It could also be some ACL permission issue - make sure you run the script / command with elevated privileges (under Administrator).
     
  12. toronto

    toronto Notebook Deity

    Reputations:
    127
    Messages:
    714
    Likes Received:
    6
    Trophy Points:
    31
    Thanks for the help. I appreciate it.

    Yes, tried with -R.

    Yes, elevated command prompt (run as Administrator).
     
  13. ray4jc

    ray4jc Notebook Evangelist

    Reputations:
    1,413
    Messages:
    437
    Likes Received:
    1
    Trophy Points:
    30
    Gonna have to give this a try. I have used Teracopy as a replacement for the default windows copy for a while now but robocopy looks like it would come in handy for running as a scheduled backup.