{"id":6429,"date":"2021-11-19T07:44:52","date_gmt":"2021-11-19T07:44:52","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=6429"},"modified":"2021-11-19T07:47:23","modified_gmt":"2021-11-19T07:47:23","slug":"ftp-script-to-delete-files-older-than-7-days","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/ftp-script-to-delete-files-older-than-7-days\/21585.html","title":{"rendered":"FTP Script To Delete Files Older Than 7 Days"},"content":{"rendered":"<p>Hello everyone, I try to wirte an batch script which shall delete files older than 7 days from an FTP Server.<\/p>\n<p>I have started with some example script. Which I was able to find here:<\/p>\n<p>REM to get the current date:<br \/>\nfor \/f &#8220;tokens=1,2,3 delims=\/ &#8221; %%a in (&#8216;DATE \/T&#8217;) do set current date=%%c%%b%%a<\/p>\n<p>REM Login to FTP server and delete all files which are mentioned in the .txt file, should be replaced to with the &#8220;older than X days function&#8221; Can someone help?<\/p>\n<p>@(ECHO o 127.0.0.1<br \/>\nECHO user admin<br \/>\nECHO admin<br \/>\nECHO cd \/test123<br \/>\nFOR \/F %%a IN (delete-files.txt) DO ECHO delete %%a<br \/>\nECHO quit) &gt; #<br \/>\nftp -n -d -s:#<br \/>\ndel #<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":12},"question-category":[55],"question_tags":[],"class_list":["post-6429","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\/6429","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=6429"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=6429"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=6429"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=6429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}