{"id":7810,"date":"2021-11-25T12:06:35","date_gmt":"2021-11-25T12:06:35","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=7810"},"modified":"2021-11-25T12:07:55","modified_gmt":"2021-11-25T12:07:55","slug":"move-files-based-on-date-modified","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/move-files-based-on-date-modified\/20853.html","title":{"rendered":"MOVE Files Based On DATE MODIFIED"},"content":{"rendered":"<p>So I created the below code to grab the YEAR of a file from the DATE MODIFIED and if it is NOT EQUAL to 2010, then move all the files in that DIR by creating a second .BAT. However, I have MANY sub-dirs, with MORE files, how can I have it go through ALL sub-dirs without having to code the sub dir each time.<\/p>\n<p>echo off &amp; setLocal EnableDELAYedExpansion<br \/>\nPUSHD Y:\\DIR1\\DIR2\\<br \/>\nSET source=Y:\\DIR1\\SUBDIR1\\<br \/>\nSET dest=&#8221;F:\\DIR1\\SUBDIR1\\&#8221;<br \/>\nfor \/f &#8220;tokens=* delims= &#8221; %%a in (&#8216;dir\/b\/a-d&#8217;) do (<br \/>\nSET DATETIME=%%~Ta<br \/>\nfor \/f &#8220;tokens=1 delims=\/: &#8221; %%m in (&#8220;%%~Ta&#8221;) DO SET month=%%m<br \/>\nfor \/f &#8220;tokens=2 delims=\/: &#8221; %%d in (&#8220;%%~Ta&#8221;) DO SET day=%%d<br \/>\nfor \/f &#8220;tokens=3 delims=\/: &#8221; %%y in (&#8220;%%~Ta&#8221;) DO SET year=%%y<br \/>\nIF &#8220;!year!&#8221; NEQ &#8220;2010&#8221; (SET FILE=%%a)<br \/>\nIF &#8220;!year!&#8221; NEQ &#8220;2010&#8221; (&gt;&gt;&#8221;F:\\MOVE.bat&#8221; ECHO MOVE \/Y &#8220;!source!!FILE!&#8221; !dest! )<br \/>\n)<br \/>\nCALL &#8220;F:\\MOVE.bat&#8221;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":7},"question-category":[55],"question_tags":[],"class_list":["post-7810","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\/7810","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=7810"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=7810"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=7810"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=7810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}