{"id":702,"date":"2022-11-28T00:52:18","date_gmt":"2022-11-28T00:52:18","guid":{"rendered":"https:\/\/lavenhamit.uk\/wrdprss\/?p=702"},"modified":"2022-12-08T13:02:39","modified_gmt":"2022-12-08T13:02:39","slug":"windows-batch-file-back-up-dropbox-to-removable-usb-drive","status":"publish","type":"post","link":"https:\/\/lavenhamit.uk\/wrdprss\/?p=702","title":{"rendered":"Windows Batch File &#8211; Back Up DropBox to Removable USB drive"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Paste the following code into a .bat text file to create a runnable script that copies your DropBox folder contents to a specified folder on any removable drives (D: thru H:) present. This excludes the dropbox cache and other hidden and system files. Double-click the batch file or run from the command line. You can change the destination folder name (after &#8216;Destination=&#8217;) or the source dropbox folder location if different (&#8220;%USERPROFILE%\\Dropbox&#8221;). You could also edit the example file (&#8216;Excludefile.123&#8217;) to exclude other files or file types (like &#8216;*.zip&#8217;)  or directories (add to &#8216;.dropbox.cache&#8217;) &#8211; use spaces to separate multiple entries &#8211; see <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows-server\/administration\/windows-commands\/robocopy\" target=\"_blank\" rel=\"noreferrer noopener\">Robocopy<\/a> for more information. A log file is created in the root of the destination drive recording what was done. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r@ECHO OFF\r\nTITLE Backup\r\nREM\r\nSET Destination=FolderOnUSB\r\nSET Counter=0\r\nECHO.\r\nECHO  DropBox BackUp Job to folder '%Destination%' on removable USB drives\r\nECHO  *** Excluding hidden '.dropbox.cache' folder, system files ***\r\nECHO.\r\nECHO  *** WARNING files-in-use may be skipped ***\r\nCALL :SleepSeconds 5\r\nREM loop thru drive letters\r\nFOR %%x in (D E F G H) DO (CALL :CopyToDrive %%x)\r\nREM\r\nECHO  Finished - Drives updated = %Counter%\r\nECHO.\r\nTIMEOUT 10\r\n\r\nEXIT \/B %ERRORLEVEL%\r\nREM\r\nREM  **************Functions*****************\r\n:CopyToDrive \r\nSET DriveLetter=%~1\r\nREM ECHO  Searching for %DriveLetter%:\\%Destination%\r\nIF EXIST \"%DriveLetter%:\\%Destination%\\\" (\r\nECHO  %DriveLetter%: Data Drive updating\r\nCALL :SleepSeconds 5\r\nROBOCOPY \"%USERPROFILE%\\Dropbox\" \"%DriveLetter%:\\%Destination%\" \/MIR \/FFT \/Z \/NP \/TEE \/XA:H \/XD .dropbox.cache \/W:5 \/XJ \/XF ExcludeFile.123 \/NFL \/log:\"%DriveLetter%:\\%Destination%-CopyLog.txt\"\r\nset \/a Counter=%Counter%+1)\r\nREM\r\nECHO.  \r\nEXIT \/B 0\r\n\r\nREM ========================================\r\n:SleepSeconds \r\nSET DelaySec=%~1\r\nTIMEOUT \/T  %DelaySec% \/NOBREAK > nul\r\nEXIT \/B 0\r\n\r<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Paste the following code into a .bat text file to create a runnable script that copies your DropBox folder contents [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,67],"tags":[78,79,77,80],"class_list":["post-702","post","type-post","status-publish","format-standard","hentry","category-programming-coding-scripting-tips","category-windows-batch-files","tag-backup","tag-copy","tag-dropbox","tag-usb"],"_links":{"self":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts\/702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=702"}],"version-history":[{"count":9,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts\/702\/revisions"}],"predecessor-version":[{"id":721,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts\/702\/revisions\/721"}],"wp:attachment":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}