{"id":3516,"date":"2012-10-24T00:01:36","date_gmt":"2012-10-24T07:01:36","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=3516"},"modified":"2012-10-26T08:26:28","modified_gmt":"2012-10-26T15:26:28","slug":"doing-a-manual-backup-automatically-part-ii","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=3516","title":{"rendered":"Doing a Manual Backup Automatically, Part II"},"content":{"rendered":"<p>Assuming that you&#8217;ve read <a href=\"http:\/\/www.wambooli.com\/blog\/?p=3500\">Monday&#8217;s blog post<\/a>, you have a thumb drive that can handle a manual copy, or backup, of some important files. This blog post describes the DOS command used to actually copy over those files.<br \/>\n<!--more--><br \/>\n<strong>Step 2: Running the manual backup program<\/strong><\/p>\n<p>Yes, only bold, strong computer users bother with DOS any more. Yet, DOS holds some power that  Windows lacks, specifically when copying files. In fact, DOS does it quite effectively, providing you have some patience.<\/p>\n<p>The DOS command I chose for copying\/backing up files is <code>robocopy<\/code>. It&#8217;s Microsoft&#8217;s third iteration of the basic file-copying command, <code>copy<\/code>. The second version was <code>xcopy<\/code>.<\/p>\n<p>I chose the <code>robocopy<\/code> command because of its <code>\/mir<\/code> switch. That switch effectively duplicates files and folders from one storage device to another. It adds files found on the source but not on the destination. It also removes files found on the destination, but not on the source. The end result is a mirror copy.<\/p>\n<p>Before you use <code>robocopy<\/code> you need to know two tidbits of information:<\/p>\n<p>&bull; First, you need to know the <em>pathname<\/em> of the folder you&#8217;re backing up.<\/p>\n<p>&bull; Second, you need to know the <em>drive letter<\/em> for the thumb drive.<\/p>\n<p>You can get the pathname from the folder&#8217;s Properties dialog box: Right-click on the folder&#8217;s icon and choose the Properties command. The Location text describes the path &#8212; but not all of it. In Figure 1, the text is <code>C:\\Users\\Dan\\Documents<\/code>. The rest of the path includes the <code>Work<\/code> folder name itself, separated from the rest of the path by a single backslash. So the full pathname is <code>C:\\Users\\Dan\\Documents\\Work<\/code><\/p>\n<div id=\"attachment_3504\" style=\"width: 352px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2012\/10\/figure-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3504\" src=\"http:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2012\/10\/figure-1.png\" alt=\"\" title=\"figure-1\" width=\"342\" height=\"243\" class=\"size-full wp-image-3504\" srcset=\"https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2012\/10\/figure-1.png 342w, https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2012\/10\/figure-1-300x213.png 300w\" sizes=\"auto, (max-width: 342px) 100vw, 342px\" \/><\/a><p id=\"caption-attachment-3504\" class=\"wp-caption-text\">Figure 1. A folder&#8217;s properties dialog box.<\/p><\/div>\n<p>Leave the folder&#8217;s Properties window open so that you can later reference the pathname.<\/p>\n<p>To discover which drive letter the thumb drive uses, visit the Computer window: Press Win+E on the keyboard. Hopefully your PC isn&#8217;t overly burdened with drive icons, so the thumb drive ketter is easy to spot. Commit that drive letter to memory, or jot it down somewhere.<\/p>\n<p>With your two tidbits of information &#8212; the folder&#8217;s pathname and the thumb drive&#8217;s drive letter &#8212; you&#8217;re ready to plunge into DOS.<\/p>\n<p>Fire up a command prompt window:<\/p>\n<ol>\n<li>Press the Win+R keyboard shortcut.<\/li>\n<li>Type <code>cmd<\/code> into the Run dialog box<\/li>\n<li>Click OK.<\/li>\n<\/ol>\n<p>Now you need to construct the <code>robocopy<\/code> command. It takes on this format:<\/p>\n<pre>robocopy [source] [destination] \/mir \/r:1<\/pre>\n<p><code>\/mir<\/code> is the mirror switch, which directs <code>robocopy<\/code> to duplicate, or mirror, the files between the source and destination.<\/p>\n<p><code>\/r:1<\/code> is a retry switch. If <code>robocopy<\/code> errors, it normally retries copying the file 1,000,000 times. I&#8217;m not kidding! By setting <code>\/r:1<\/code>, <code>robocopy<\/code> retries only once before moving on.<\/p>\n<p>Here&#8217;s how to deconstruct the <code>robocopy<\/code> command to perform a backup or mirror of a folder:<\/p>\n<ol>\n<li>At the DOS prompt, type <code>robocopy<\/code> and a space.<\/li>\n<li>Type the pathname to the folder you want to duplicate. On my PC, I type <code>C:\\Users\\Dan\\Documents\\Work<\/code><\/li>\n<li>Type another space.<\/li>\n<li>Type the Destination drive letter for the thumb drive, followed by a colon. For example type <code>F:<\/code> for drive F.<\/li>\n<li>Type <code>\\backup<\/code>. The destination should look like <code>F:\\backup<\/code>. I recommend typing a folder name like <code>backup<\/code> so that the duplicate files don&#8217;t reside in the main, or root, folder on the thumb drive.<\/li>\n<li>Type a space, then <code>\/mir<\/code><\/li>\n<li>Type another space, then <code>\/r:1<\/code><\/li>\n<\/ol>\n<p>Confirm the command. On my computer, the command looks like this:<\/p>\n<p><code>robocopy c:\\Users\\Dan\\Documents\\Work f:\\work.bak \/mir \/r:1<\/code><\/p>\n<p>That command duplicates files in my <code>Work<\/code> folder &#8212; and all its subfolders &#8212; onto drive F in the <code>work.bak<\/code> directory.<\/p>\n<p>And now, the big moment: Ensure that the thumb drive is inserted in the USB port, then press the Enter key to run the command.<\/p>\n<p>If all goes well, then you&#8217;ll see a quickly scrolling screen, detailing all the files as they&#8217;re duplicated.<\/p>\n<p>Close the command prompt window, and all other open windows, after <code>robocopy<\/code> has displayed its summary.<\/p>\n<p>If there is a problem, check the command line: Press the F3 key. Ensure that you have all the proper slashes pointing in the correct direction. Ensure that you typed in the correct pathname. If the pathname contains spaces, you may need to place them in double quotes, as in:<\/p>\n<p><code>robocopy \"c:\\Users\\Dan\\Documents\\Business Letters\" f:\\work.bak \/mir \/r:1<\/code><\/p>\n<p><strong>Notes<\/strong><\/p>\n<p>The first backup takes the longest. That&#8217;s because all the files must be copied. After that, <code>robocopy<\/code> duplicates only updated files. It also removes files you&#8217;ve deleted on the source. Again, that <code>\/mir<\/code> switch is about mirroring the copies so that both are up-to-date.<\/p>\n<p>While <code>robocopy<\/code> and the pathname nonsense may seem burdensome, consider that the copy is made &#8212; and updated &#8212; by using that single <code>robocopy<\/code> command. There&#8217;s no windows to open, no repetitive drag-and-drop operations.<\/p>\n<p>On <a href=\"http:\/\/www.wambooli.com\/blog\/?p=3508\">Friday&#8217;s blog post<\/a> I&#8217;ll describe how to use the Task Scheduler to run <code>robocopy<\/code> for you automatically.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Assuming that you&#8217;ve read Monday&#8217;s blog post, you have a thumb drive that can handle a manual copy, or backup, of some important files. This blog post describes the DOS command used to actually copy over those files.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3516","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3516"}],"version-history":[{"count":19,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3516\/revisions"}],"predecessor-version":[{"id":3596,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3516\/revisions\/3596"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}