{"id":603,"date":"2010-11-20T19:02:48","date_gmt":"2010-11-20T19:02:48","guid":{"rendered":"https:\/\/www.buarotti.ch\/?p=603"},"modified":"2011-04-22T09:36:21","modified_gmt":"2011-04-22T09:36:21","slug":"forfiles-command-old-file-handling","status":"publish","type":"post","link":"https:\/\/www.buarotti.ch\/?p=603","title":{"rendered":"Forfiles Command \u2013 Old file handling"},"content":{"rendered":"<p>Ich habe ein Batch Script erstellt welches alte Files und Ordner l\u00f6scht. F\u00fcr das script kann keine Haftung \u00fcbernommen werden. Bitte zuerst mit unproduktiven Daten testen!<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n@echo off\r\nTitle Deleting SQL Snapshotfiles\r\n\r\nSet Day=5\r\nSet Pfad=&quot;D:\\SQL&quot;\r\nSet Log=Deleting_Snapshot.log\r\n\r\necho Starte Task...\r\necho &#x5B;%date%-%time%]\u00a0\u00a0 \u00a0Starte Deleting SQL Snapshotfiles &gt;&gt;%Log%\r\necho.\r\necho.\r\necho.\r\necho &#x5B;%date%-%time%]\u00a0\u00a0 \u00a0Deleting Old Snapshot Files &gt;&gt;%Log%\r\n\r\n:: REMOVE OLD SNAPSHOT FILES\r\nFORFILES \/P %Pfad% \/S \/M *.* \/D -%Day% \/C &quot;cmd \/c echo @relpath &amp; del @path \/f \/q&quot;\r\n\r\n:: REMOVE EMPTY SUBFOLDERS\r\necho &#x5B;%date%-%time%]\u00a0\u00a0 \u00a0Deleting Empty Subfolders &gt;&gt;%Log%\r\nfor \/f &quot;tokens=*&quot; %%A in ('dir \/ad \/s \/b %Pfad% ^|Sort \/Reverse') do (\r\n RmDir &quot;%%A&quot; 2&gt;NUL\r\n)\r\n\r\n:: REMOVE FOLDER, IF EMPTY\r\nRmDir %Pfad% 2&gt;NUL\r\n\r\necho &#x5B;%date%-%time%]\u00a0\u00a0 \u00a0Finish Deleting SQL Snapshotfiles &gt;&gt;%Log%\r\nexit\r\n<\/pre>\n<h3>Related Images:<\/h3>","protected":false},"excerpt":{"rendered":"<p>Ich habe ein Batch Script erstellt welches alte Files und Ordner l\u00f6scht. F\u00fcr das script kann keine Haftung \u00fcbernommen werden. Bitte zuerst mit unproduktiven Daten testen! @echo off Title Deleting SQL Snapshotfiles Set Day=5 Set Pfad=&quot;D:\\SQL&quot; Set Log=Deleting_Snapshot.log echo Starte Task&#8230; echo &#x5B;%date%-%time%]\u00a0\u00a0 \u00a0Starte Deleting SQL Snapshotfiles &gt;&gt;%Log% echo. echo. echo. echo &#x5B;%date%-%time%]\u00a0\u00a0 \u00a0Deleting Old [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[32],"tags":[],"class_list":["post-603","post","type-post","status-publish","format-standard","hentry","category-batch"],"_links":{"self":[{"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=\/wp\/v2\/posts\/603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=603"}],"version-history":[{"count":10,"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=\/wp\/v2\/posts\/603\/revisions"}],"predecessor-version":[{"id":651,"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=\/wp\/v2\/posts\/603\/revisions\/651"}],"wp:attachment":[{"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.buarotti.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}