{"id":6137,"date":"2021-11-18T08:08:01","date_gmt":"2021-11-18T08:08:01","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=6137"},"modified":"2021-11-18T08:08:51","modified_gmt":"2021-11-18T08:08:51","slug":"how-to-create-folders-from-batch-file-using-date-taken","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/how-to-create-folders-from-batch-file-using-date-taken\/27742.html","title":{"rendered":"How To Create Folders From Batch File Using Date Taken"},"content":{"rendered":"<p>I am looking to write a batch file that I can execute on all files within a folder, which will create subfolders from the &#8220;date taken&#8221; property of each file (some of these files are photos) in the format &#8220;yyyy-mm-dd&#8221;. In addition, (else statement?) I would like any file which does not have a &#8220;date taken&#8221; property (video files) to have a subfolder created matching the &#8220;date created&#8221; property. Lastly, I would like the script to move the file in question to its newly created subfolder.<\/p>\n<p>I have tried some variations of the FOR command (found in other people&#8217;s questions) with limited success, but I have been able to create subfolders as &#8220;mm\\yyyy\\mm\\dd&#8221; which nests a lot of folders instead of &#8220;yyyy-mm-dd&#8221;:<\/p>\n<p>for \/D %%Q IN (*.*) DO (<br \/>\nset FILETIME=%%~tQ<br \/>\nMD &#8220;!FILETIME:~0,10!&#8221;<br \/>\n)<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":17},"question-category":[55],"question_tags":[],"class_list":["post-6137","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\/6137","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=6137"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=6137"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=6137"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=6137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}