{"id":11204,"date":"2021-12-07T11:17:18","date_gmt":"2021-12-07T11:17:18","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=11204"},"modified":"2021-12-07T11:17:34","modified_gmt":"2021-12-07T11:17:34","slug":"solved-find-folder-with-largest-number-by-batch","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/find-folder-with-largest-number-by-batch\/26569.html","title":{"rendered":"Solved Find Folder With Largest Number By Batch"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I am trying to write a batch file to find the folder that has the largest number in its name.<\/p>\n<p>i.e. I have 3 dummy folders with alphanumeric names in the directory<br \/>\nProd110000<br \/>\nProd112000<br \/>\nProd114000<\/p>\n<p>So it should find &#8220;Prod114000&#8221; for me. I&#8217;m trying to pull just the numbers part of the folder name so I can use GTR to compare &#8211; I am having troubles pulling the numbers part out of the batch variable (%%G) though because I can&#8217;t manipulate it.<\/p>\n<p>I suspect there is also some problem in the &#8220;set latestdir=%%G&#8221; statement too.<\/p>\n<p>What I (only) have right now is this:<br \/>\ng:<br \/>\ncd G:\\xxxxxxxx<\/p>\n<p>for \/D %%G in (&#8220;Prod*&#8221;) do if %%G GTR %latestdir:~4,10% set latestdir=%%G<\/p>\n<p>Thanks for the help!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":1},"question-category":[55],"question_tags":[],"class_list":["post-11204","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\/11204","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=11204"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=11204"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=11204"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=11204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}