{"id":10631,"date":"2021-12-06T09:04:28","date_gmt":"2021-12-06T09:04:28","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=10631"},"modified":"2021-12-06T09:04:45","modified_gmt":"2021-12-06T09:04:45","slug":"solved-robocopy-delete-old-folders-by-oldest-date","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/robocopy-delete-old-folders-by-oldest-date\/29625.html","title":{"rendered":"Solved Robocopy Delete Old Folders By Oldest Date"},"content":{"rendered":"<p>I am working on a backup script to delete old folders from a folder.My backup folder looks like this (backup_mm_dd_year is a folder)<\/p>\n<p>C:\\backups\\backup_5_1_2014<br \/>\nC:\\backups\\backup_5_2_2014<br \/>\nC:\\backups\\backup_5_3_2014<br \/>\nC:\\backups\\backup_5_4_2014<br \/>\nC:\\backups\\backup_5_6_2014<br \/>\nC:\\backups\\backup_5_7_2014<br \/>\nC:\\backups\\backup_5_8_2014<br \/>\nC:\\backups\\backup_5_9_2014<br \/>\nC:\\backups\\backup_5_10_2014<br \/>\nC:\\backups\\backup_5_12_2014<\/p>\n<p>I was looking at using robocopy to delete folders older than say 7 days. That is, let&#8217;s say I run a script on day 13, it should delete any backup_mm_dd_yy older than 7 days. that means it should delete backup 5_1-3_2014.<\/p>\n<p>I see that robocopy have a switch &#8212; \/maxage:n &#8212; exclude files older than n days\/date. Is there anyway to tell robocopy to simply check at the folder level instead of at the file level?<\/p>\n<p>In essence, I simply want robocopy to check \/maxage:n at the folder level instead of checking at the file level.<\/p>\n<p>Any help will be greatly appreciated.<\/p>\n<p align=\"right\"><span style=\"font-size: xx-small;\"><i>message edited by xirsteon<\/i><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":8},"question-category":[55],"question_tags":[],"class_list":["post-10631","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\/10631","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=10631"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=10631"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=10631"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=10631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}