{"id":250,"date":"2012-12-06T12:55:49","date_gmt":"2012-12-06T12:55:49","guid":{"rendered":"http:\/\/www.edwardsd.co.uk\/work\/?p=250"},"modified":"2021-07-05T11:46:36","modified_gmt":"2021-07-05T10:46:36","slug":"xcopy-complete-c-drive-copy","status":"publish","type":"post","link":"https:\/\/www.edwardsd.co.uk\/work\/2012\/12\/xcopy-complete-c-drive-copy\/","title":{"rendered":"Robocopy (FileServer Migration)"},"content":{"rendered":"<p>I often use Robocopy when migrating\/copying data from file servers.<\/p>\n<p><span style=\"color: #333333; font-size: 15.454545021057129px; font-style: normal; line-height: 21.81818199157715px;\">When running the copy process to transfer data from&nbsp;Windows&nbsp;Server 2003 to Windows Server 2008 I usually run robocopy from the destination server (usually the newer server) in order that it will use&nbsp;<\/span><a style=\"font-size: 15.454545021057129px; font-style: normal; line-height: 21.81818199157715px;\" title=\"Robocopy Versions\" href=\"http:\/\/en.wikipedia.org\/wiki\/Robocopy#Versions\" target=\"_blank\" rel=\"noopener\">version XP027<\/a>&nbsp;(5.1.10) There are a number of&nbsp;<a title=\"Robocopy Limitations\" href=\"http:\/\/en.wikipedia.org\/wiki\/Robocopy#Limitations\" target=\"_blank\" rel=\"noopener\">flaws<\/a>&nbsp;in XP026 and also requires a seperate download&nbsp;Windows 2003 Resource Kit&nbsp;to obtain it.<\/p>\n<p>This is the main syntax I use to perform a full copy.<\/p>\n<pre lang=\"basic\">robocopy D:\\Source E:\\Destination \/MIR \/R:1 \/W:1 \/COPYALL<\/pre>\n<p>Example, when copying from another server (using UNC):<\/p>\n<pre lang=\"basic\">robocopy \\\\myserver\\e$\\data E:\\data \/MIR \/R:1 \/W:1 \/COPYALL<\/pre>\n<p>Although &#8220;\/MIR&#8221; is mirroring the data, this will not actually copy the ACL permissions, therefore you will need to ensure that \/COPYALL is included. I&#8217;ve copied a whole load of data before without including this only to find I have had to recopy to correct the ACL.<\/p>\n<p><strong>\/COPYALL :<\/strong> Copy ALL file info (equivalent to \/COPY:DATSOU) including timescamps, permissions, ACL, other attributes.<br \/>\n<strong>\/MIR :<\/strong> MIRror a directory tree &#8211; equivalent to \/PURGE plus all subfolders (\/E)<br \/>\n<strong>\/R:n :<\/strong> Number of Retries on failed copies &#8211; default is 1 million.<br \/>\n<strong>\/W:n :<\/strong> Wait time between retries &#8211; default is 30 seconds.<\/p>\n<p>Sometimes the copy may set the top level folder to &#8220;hidden&#8221; This can be un-hidden&nbsp;using the &#8220;<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-server\/administration\/windows-commands\/attrib\">attrib<\/a>&#8221; command:<\/p>\n<pre lang=\"basic\">attrib -h -s E:\\data<\/pre>\n<p><strong>-s :<\/strong> Removes the system file attribute.<br \/>\n<strong>-h :<\/strong> Removes the hidden file attribute.<\/p>\n<p><!--more--><\/p>\n<p>For reference this is the old method I used to use with the &#8220;xcopy&#8221; command, usually if robocopy is unavailable.<\/p>\n<p>This command will copy all files, including those in sub-folders, that are newer in the source folder. It will copy hidden as well as read-only files and will create the destination folder and\/or sub-folders if they do not already exist.<\/p>\n<ul>\n<li>xcopy C:\\*.* E:\\setdir \/D \/E \/C \/R \/H \/I \/K \/Y<\/li>\n<li>robocopy.exe C:\\ E:\\Backup \/XO \/COPYALL \/LOG:E:\\BackupLog.txt (Created a logfile in e:\\)<\/li>\n<\/ul>\n<p><strong>Perform flat copy:<\/strong><\/p>\n<ul>\n<li>XCopy d:\\*.* C:\\CD-copy\\ \/v \/s \/h<\/li>\n<\/ul>\n<p><strong>Switches:<\/strong><\/p>\n<ul>\n<li><em>\/d &#8211; date Copies files changed on or after the specified date. <\/em><\/li>\n<li><em>\/e &#8211; Copies any subfolder, even if it is empty.<\/em><\/li>\n<li><em>\/c &#8211; Continues copying even if errors occur.<\/em><\/li>\n<li><em>\/r &#8211; Overwrites read-only files.<\/em><\/li>\n<li><em>\/h &#8211; Copies hidden and system files.<\/em><\/li>\n<li><em>\/i &#8211; If the destination does not exist, and you are copying more than one file, this switch assumes that the <\/em><em>destination is a folder.<\/em><\/li>\n<li><em>\/k &#8211; Copies attributes. Typical xcopy commands reset read-only attributes.<\/em><\/li>\n<li><em>\/y &#8211; Overwrites existing files without prompting you.<\/em><\/li>\n<li><em>\/v<\/em> &#8211; verification<\/li>\n<li><em>\/s<\/em> &#8211; subfolder or directories<\/li>\n<li><em>\/h<\/em> &#8211; hidden files<\/li>\n<\/ul>\n<p>Source: <a href=\"http:\/\/support.microsoft.com\/kb\/289483\">http:\/\/support.microsoft.com\/kb\/289483<\/a>&nbsp;(xcopy switches)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I often use Robocopy when migrating\/copying data from file servers. When running the copy process to transfer data from&nbsp;Windows&nbsp;Server 2003 to Windows Server 2008 I usually run robocopy from the destination server (usually the newer server) in order that it will use&nbsp;version XP027&nbsp;(5.1.10) There are a number of&nbsp;flaws&nbsp;in XP026 and also requires a seperate download&nbsp;Windows [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,21,10],"tags":[],"class_list":["post-250","post","type-post","status-publish","format-standard","hentry","category-bat","category-code","category-tools"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pOPt8-42","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":2,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"predecessor-version":[{"id":3726,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/250\/revisions\/3726"}],"wp:attachment":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}