Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tpkn/folder-cleanup

A Nodejs plugin that helps you remove old files and folders
https://github.com/tpkn/folder-cleanup

Last synced: about 2 months ago
JSON representation

A Nodejs plugin that helps you remove old files and folders

Awesome Lists containing this project

README

        

# Folder Cleanup
Helps you remove old files and folders

A convenient way to rid of files and folders that are older than specified amount of time.
Cleanup function takes two arguments:
1. folder path
2. maximum file age (in milliseconds)

## Usage
```javascript
const cleanup = require('folder-cleanup');

let max_age = '5d';
let temp_uploads = '/usr/www/domain.me/temp_uploads';

// Deleting files that were created later than 5 days ago
cleanup(temp_uploads, max_age);
```

People who are feeling nauseous just thinking of how they will converting 90 weeks into milliseconds, could use already [built-in time converter](https://www.npmjs.com/package/string-to-ms).