{"id":3325,"date":"2021-11-03T12:42:25","date_gmt":"2021-11-03T12:42:25","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=3325"},"modified":"2021-11-03T12:42:56","modified_gmt":"2021-11-03T12:42:56","slug":"count-for-files-in-directory-and-start-xcopy","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/count-for-files-in-directory-and-start-xcopy\/25804.html","title":{"rendered":"Count For Files In Directory And Start Xcopy"},"content":{"rendered":"<p>Hello gurus,<\/p>\n<p>I am facing the below issue.<br \/>\nI have some files in directory Dir_1 , and I need to copy them in another directory Dir_2.<\/p>\n<p>Well, here I go.<br \/>\nI thought this would have done the job, but it isn&#8217;t.<br \/>\nWhat am I missing?<\/p>\n<pre>@echo off &amp; setLocal EnableDELAYedeXpansion\r\n\r\npushd D:\\Dir_1\r\n\r\nfor \/F %%j in (dir D:\\Dir_1 \/A-D | find \/c \"OK_ARCHIVE\") do set Count=%%jdo set Count=%%j\r\n\r\nif %count% EQU 0 (\r\n    echo No files found in the specified folder&gt;&gt;FilesError.log\r\n) else (\r\nfor \/L %%b in (1 1 %count%) do ( xcopy \"D:\\Dir_1\"  \"G:\\Dir_2\" \/D \/I \/Y)\r\necho A total of !count! files have been copied&gt;&gt;FilesSuccess.log\r\n)\r\nmove FilesSuccess.log D:\\Dir_3\r\nmove FilesError.log D:\\Dir_3\r\n<\/pre>\n<p>after executing, I am getting<\/p>\n<pre>| was unexpected at this time.\r\n<\/pre>\n<p>Please help,<br \/>\nThnx and regards<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":9},"question-category":[55],"question_tags":[],"class_list":["post-3325","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/3325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=3325"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=3325"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=3325"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=3325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}