{"id":721,"date":"2012-12-15T15:35:42","date_gmt":"2012-12-15T13:35:42","guid":{"rendered":"http:\/\/www.netexpertise.eu\/en\/?p=721"},"modified":"2021-10-12T22:36:40","modified_gmt":"2021-10-12T20:36:40","slug":"windows-remote-servernas-backup-script","status":"publish","type":"post","link":"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html","title":{"rendered":"Windows Remote Server\/NAS Sync and Backup Files"},"content":{"rendered":"\n<p><a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/cc733145(v=ws.10).aspx\" target=\"_blank\" rel=\"noreferrer noopener\">robocopy<\/a> is a tool that copies files but more interestingly, it lets you synchronize data from a server (or a NAS) to another Windows server. It is provided with the Windows 2003 Server <a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=17657\" target=\"_blank\" rel=\"noreferrer noopener\">resource kit tools<\/a> or natively in Windows 2008 Server and above.<br>Synchronization takes little bandwidth with Robocopy and can be a good way to <a href=\"\/en\/category\/systems\/backup\">backup<\/a> files over a slow network link.<br>&nbsp;<br>Here is a DOS script that synchronises data from a remote server&#8217;s shared folders to a local server. It could be the other way around of course. Any usual backup software can then handle files copied locally, saving them to tape if you wish.<br>Backup software do not provide agents we can install on a NAS most of the time. I use this sync script for remote sites with files hosted on a NAS or a Windows server that do not have a backup software locally.<br>&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">@echo off\nCLS\n\nSETLOCAL ENABLEDELAYEDEXPANSION\nset REMOTE_NAS=192.168.1.250\nset LOCAL_DIRECTORY=C:\\Copy\nset EXCLUDE_DIR=\"Shares Not To be Backed Up\"\n\nrem Go through server\/NAS shares\nfor \/F \"tokens=1 delims=\" %%K in ^\n  ('net view %REMOTE_NAS%^|findstr Disk^|findstr \/V %EXCLUDE_DIR%') do (\n  set SHARELINE=%%K\n  set SHARELINE=!SHARELINE:Disk=#!\n  \n  rem Sync files in the share\n  for \/F \"tokens=1 delims=#\" %%S in (\"!SHARELINE!\") do (\n    set SHARE=%%S\n    echo Processing \\\\%REMOTE_NAS%\\!SHARE!...\n    robocopy \"\\\\%REMOTE_NAS%\\!SHARE!\" \"%LOCAL_DIRECTORY%\\!SHARE!\" ^\n    \/XF *.avi Thumbs.db \/XD Temp* \/E \/COPY:DAT \/R:0 \/W:1 \/NP\n  )\n)<\/code><\/pre>\n\n\n\n<p>&nbsp;<br>Save with a BAT extension as with any DOS script. Change settings according to your setup and create a scheduled task to be run over night in Windows task scheduler.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>robocopy is a tool that copies files but more interestingly, it lets you synchronize data from a server (or a NAS) to another Windows server. It is provided with the Windows 2003 Server resource kit tools or natively in Windows 2008 Server and above.Synchronization takes little bandwidth with Robocopy and can be a good way [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[319,70],"tags":[58,256,99,391],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Netexpertise - Windows Remote Server\/NAS Sync and Backup Files<\/title>\n<meta name=\"description\" content=\"Sync your files stored on a remote NAS or Windows Server over the network with Robocopy and save them on your central backup software\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Netexpertise - Windows Remote Server\/NAS Sync and Backup Files\" \/>\n<meta property=\"og:description\" content=\"Sync your files stored on a remote NAS or Windows Server over the network with Robocopy and save them on your central backup software\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html\" \/>\n<meta property=\"og:site_name\" content=\"Netexpertise\" \/>\n<meta property=\"article:published_time\" content=\"2012-12-15T13:35:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-12T20:36:40+00:00\" \/>\n<meta name=\"author\" content=\"dave\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@netexpertise\" \/>\n<meta name=\"twitter:site\" content=\"@netexpertise\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html\",\"name\":\"Netexpertise - Windows Remote Server\/NAS Sync and Backup Files\",\"isPartOf\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\"},\"datePublished\":\"2012-12-15T13:35:42+00:00\",\"dateModified\":\"2021-10-12T20:36:40+00:00\",\"author\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\"},\"description\":\"Sync your files stored on a remote NAS or Windows Server over the network with Robocopy and save them on your central backup software\",\"breadcrumb\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.netexpertise.eu\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Windows Remote Server\/NAS Sync and Backup Files\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/\",\"name\":\"Netexpertise\",\"description\":\"Systems \/ Networks \/ DevOps\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\",\"name\":\"dave\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"caption\":\"dave\"},\"sameAs\":[\"http:\/\/www.netexpertise.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Netexpertise - Windows Remote Server\/NAS Sync and Backup Files","description":"Sync your files stored on a remote NAS or Windows Server over the network with Robocopy and save them on your central backup software","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html","og_locale":"en_US","og_type":"article","og_title":"Netexpertise - Windows Remote Server\/NAS Sync and Backup Files","og_description":"Sync your files stored on a remote NAS or Windows Server over the network with Robocopy and save them on your central backup software","og_url":"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html","og_site_name":"Netexpertise","article_published_time":"2012-12-15T13:35:42+00:00","article_modified_time":"2021-10-12T20:36:40+00:00","author":"dave","twitter_card":"summary_large_image","twitter_creator":"@netexpertise","twitter_site":"@netexpertise","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html","url":"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html","name":"Netexpertise - Windows Remote Server\/NAS Sync and Backup Files","isPartOf":{"@id":"http:\/\/www.netexpertise.eu\/en\/#website"},"datePublished":"2012-12-15T13:35:42+00:00","dateModified":"2021-10-12T20:36:40+00:00","author":{"@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa"},"description":"Sync your files stored on a remote NAS or Windows Server over the network with Robocopy and save them on your central backup software","breadcrumb":{"@id":"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/windows\/windows-remote-servernas-backup-script.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.netexpertise.eu\/en"},{"@type":"ListItem","position":2,"name":"Windows Remote Server\/NAS Sync and Backup Files"}]},{"@type":"WebSite","@id":"http:\/\/www.netexpertise.eu\/en\/#website","url":"http:\/\/www.netexpertise.eu\/en\/","name":"Netexpertise","description":"Systems \/ Networks \/ DevOps","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa","name":"dave","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","caption":"dave"},"sameAs":["http:\/\/www.netexpertise.eu"]}]}},"_links":{"self":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/721"}],"collection":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/comments?post=721"}],"version-history":[{"count":0,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/721\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/media?parent=721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/categories?post=721"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/tags?post=721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}