{"id":1464,"date":"2009-10-20T19:16:28","date_gmt":"2009-10-20T19:16:28","guid":{"rendered":"http:\/\/nycphantom.com\/journal\/?p=1464"},"modified":"2009-10-20T19:16:28","modified_gmt":"2009-10-20T19:16:28","slug":"synchronizing-two-networked-folders","status":"publish","type":"post","link":"http:\/\/nycphantom.com\/journal\/?p=1464","title":{"rendered":"Synchronizing two networked folders"},"content":{"rendered":"<p>\nLabored whole day, just to come up with a batch file using XCOPY to do it.\n<\/p>\n<p>\nIn the case of synchronizing removed files, I used for loop, but the big trick was the setlocal EnableDelayedExpansion command. Without it, the variable seems to be non-dynamic.\n<\/p>\n<p>\nI supposed I have to settle with it now anyhow, it is just not worth the time, despite the fact that I cannot remove hidden files, chinese character filenames, if they somehow exist on the backup folder. Nonetheless, at least all my Work files can now be backed up by a click on the batch file shortcut.\n<\/p>\n<p>\nSample:\n<\/p>\n<p>\n<em>@echo off<br \/>\necho Syncrhonizing with Backup Network Drive...<br \/>\nsetlocal EnableDelayedExpansion<br \/>\nFOR \/F &quot;delims=&quot; %%a in ('dir \/b \/a \/s &quot;\\\\networkedpc\\Work&quot;') Do (set poi=%%a &amp;&amp; if not exist G:\\Work\\!poi:~22! (echo &quot;Deleting %%a...&quot; &amp;&amp; del \/Q %%a))<br \/>\nendlocal<\/p>\n<p>XCOPY &quot;G:\\Work&quot; &quot;\\\\networkedpc\\Work&quot; \/D \/I \/S \/Y<br \/>\necho ...Synchronization Complete###<br \/>\npause<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Labored whole day, just to come up with a batch file using XCOPY to do it. In the case of synchronizing removed files, I used for loop, but the big trick was the setlocal EnableDelayedExpansion command. Without it, the variable &hellip; <a href=\"http:\/\/nycphantom.com\/journal\/?p=1464\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1464","post","type-post","status-publish","format-standard","hentry","category-technical"],"_links":{"self":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/1464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1464"}],"version-history":[{"count":0,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/1464\/revisions"}],"wp:attachment":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1464"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}