{"id":3485,"date":"2019-02-12T16:09:16","date_gmt":"2019-02-12T16:09:16","guid":{"rendered":"https:\/\/cyflexdoc.wpengine.com\/usage-help-manual\/1-utilities-and-user-commands\/cleanup\/"},"modified":"2026-05-27T15:18:45","modified_gmt":"2026-05-27T20:18:45","slug":"cleanup","status":"publish","type":"page","link":"https:\/\/cyflex.com\/index.php\/usage-help-manual\/10-standard-services\/cleanup\/","title":{"rendered":"cleanup"},"content":{"rendered":"<h3>Purpose:<\/h3>\n<dl>\n<dd>Delete files from a specified directory based on file age, the maximum number of files, and disk usage percentage.<\/dd>\n<\/dl>\n<h3>Enter:<\/h3>\n<dl>\n<dd>\n<p><strong>cleanup<\/strong> &lt;max_age&gt; &lt;max_files&gt; &lt;&#8220;file_filter&#8221;&gt; [percent] [-r]<\/p>\n<\/dd>\n<\/dl>\n<h3>Where:<\/h3>\n<dl>\n<dd>\n<div>\n<table style=\"width: 73.9579%; height: 139px;\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col \/>\n<col \/> <\/colgroup>\n<tbody>\n<tr style=\"height: 23px;\">\n<td style=\"height: 23px;\">max_age<\/td>\n<td style=\"height: 23px;\">Specify the maximum file age in days.<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"height: 23px;\">max_files<\/td>\n<td style=\"height: 23px;\">Specify the maximum number of files to keep.<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"height: 23px;\">file_filter<\/td>\n<td style=\"height: 23px;\">Specify a pathname and file filter enclosed in quotes.<\/td>\n<\/tr>\n<tr style=\"height: 47px;\">\n<td style=\"height: 47px;\">percent<\/td>\n<td style=\"height: 47px;\">Optional. Specify the minimum disk percent used before cleanup is executed. Default value is 0.<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"height: 23px;\">-r<\/td>\n<td style=\"height: 23px;\">Optional. Specify recursion for subdirectories.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/dd>\n<\/dl>\n<h3>Example:<\/h3>\n<dl>\n<dd><strong>cleanup<\/strong> 7 100 &#8220;\/data\/compressed\/1999*.hst&#8221;<\/p>\n<p>The above command removes files in the \/data\/compressed\/ directory which have the .hst extender and begin with 1999, if the files are older than 7 days and if the number exceeds 100. If the number of files exceeds 100, the oldest ones are removed until only 100 are left.<\/p>\n<p><strong>cleanup<\/strong> 7 1000 &#8220;\/data\/compressed\/1999*.hst&#8221;<\/p>\n<p>The above command removes all files in the \/data\/compressed\/ directory which have the .hst extender, begin with 1999, and are older than 7 days. If the number of files exceeds 1000, the oldest ones are removed until only 1000 are left.<\/dd>\n<dd>\n<strong>cleanup<\/strong> 7 1000 &#8220;\/data\/compressed\/1999*.hst&#8221; percent=50<\/p>\n<p>The above command removes all files in the \/data\/compressed\/ directory which have the .hst extender, begin with 1999, and are older than 7 days if the percentage of disk space used is greater than 50. Oldest files are removed until only 1000 are left.<\/p>\n<p><strong>cleanup<\/strong> 7 100 &#8220;\/data\/hold\/n*&#8221; -r<\/p>\n<p>The above command removes n* files in the \/data\/hold\/ directory and its subdirectories that are older than 7 days, up to a maximum of 100 files in all.<\/p>\n<\/dd>\n<\/dl>\n<h3>Notes:<\/h3>\n<dl>\n<dd>A log of removed files will be written into a file named \/data\/cleaned_files.YYMMDD<\/dd>\n<\/dl>\n<h3>See Also:<\/h3>\n<dl>\n<dd>\n<p><a href=\"https:\/\/cyflex.com\/index.php\/usage-help-manual\/10-standard-services\/usercron\/\">usercron<\/a>, <a href=\"https:\/\/cyflex.com\/wp-content\/uploads\/Usercron-Utility.pdf\">Usercron Utility<\/a>\u00a0<\/p>\n<\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Purpose: Delete files from a specified directory based on file age, the maximum number of files, and disk usage percentage. Enter: cleanup &lt;max_age&gt; &lt;max_files&gt; &lt;&#8220;file_filter&#8221;&gt; [percent] [-r] Where: max_age Specify the maximum file age in days. max_files Specify the maximum number of files to keep. file_filter Specify a pathname and file filter enclosed in quotes. [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"parent":1950,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3485","page","type-page","status-publish","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/comments?post=3485"}],"version-history":[{"count":1,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3485\/revisions"}],"predecessor-version":[{"id":15394,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3485\/revisions\/15394"}],"up":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/1950"}],"wp:attachment":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/media?parent=3485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}