{"id":22574697,"url":"https://github.com/pepkorit/node-util-fileclean","last_synced_at":"2026-04-12T16:09:44.802Z","repository":{"id":80780559,"uuid":"92323947","full_name":"PepkorIT/node-util-fileclean","owner":"PepkorIT","description":"Basic nodejs utility script for cleaning up old files via a glob","archived":false,"fork":false,"pushed_at":"2017-05-25T05:46:47.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-02T15:33:50.354Z","etag":null,"topics":["cleanup","node","oldfiles","script"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PepkorIT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-24T18:28:44.000Z","updated_at":"2017-05-25T05:35:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f84cfad-53aa-474f-9db4-bca3598188dc","html_url":"https://github.com/PepkorIT/node-util-fileclean","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PepkorIT%2Fnode-util-fileclean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PepkorIT%2Fnode-util-fileclean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PepkorIT%2Fnode-util-fileclean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PepkorIT%2Fnode-util-fileclean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PepkorIT","download_url":"https://codeload.github.com/PepkorIT/node-util-fileclean/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246051435,"owners_count":20715851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cleanup","node","oldfiles","script"],"created_at":"2024-12-08T03:07:39.417Z","updated_at":"2026-04-12T16:09:44.761Z","avatar_url":"https://github.com/PepkorIT.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-util-fileclean\nBasic nodejs utility script for cleaning up old files via a glob\n\nTo install use:\n```shell\nnpm install node-util-fileclean --save\n```\n\n### Purpose\nThis script is designed to clean out old files.   \nFor example \"delete all old old files in ./reports directory that are older than 3 days\"\nThe script finds all files using a supplied glob then orders using the [mtime or last modified time](https://nodejs.org/api/fs.html#fs_stat_time_values).\n\n### Running the script\nTo run the script run the executable bin file provided, e.g:\n```\n./node_modules/.bin/node-util-fileclean --globs=\"./reports/*.html\" --maxAgeDays=3 --dryRun=false\n```\nThe above will delete any html files in the ./reports/ directory.  \nNote the flag: --dryRun=false, without this flag set to false the script will simply output the files to delete and the ones to keep to the console.\n\n### Script Flags\nThe following is a list of the flags that the script supports. \n\n`--globs=\"./reports/*.html,./output/**/*\"`\n\n\u003e This flag is always required as it identifies all of the files in question.   \n\u003e Globs are separated using commas, no spaces.  \n\u003e This uses [globby](https://github.com/sindresorhus/globby) under the hood so please view documentation there to see all options.\n\n`--maxAgeDays=1` `--maxAgeHours=1` `--maxAgeMins=1`\n\n\u003e The above is a list of the time flags that are possible. If you supply a time flag files older \n\u003e than the supplied value will be deleted. Only 1 is supported at a time.\n\n`--maxFiles=100`\n\n\u003e This flag will set the total number of files that is kept.\n\n`--dryRun=false`\n\n\u003e This flag is optional and will default to true. When set to true no files will be deleted so it can \n\u003e give you a chance to manually check the result. When set to false the files will be deleted.  \n\u003e The script will always output a list of all the files it has found and sorted for your review.   \n\u003e X prefix means delete, O prefix means keep.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepkorit%2Fnode-util-fileclean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpepkorit%2Fnode-util-fileclean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepkorit%2Fnode-util-fileclean/lists"}