oldfilesremover@1.0.0

oldfilesremover@1.0.0

Component to remove old files.

By @mantradev

Install with:

$ mantrad download-component oldfilesremover@1.0.0

Or install last version with:

$ mantrad download-component oldfilesremover

README.md

oldfilesremover Mantra component

This component removed files from a folder older than x seconds.

It also can run a "deep remove", this is, scans all nested folders as well and remove them if they are empty.

API exposed by oldfilesremoved

async Mantra.api.oldfilesremover.remove( Mantra, options )

Removes all files inside a folder according to options indicated as parameter.

Paramenters:

  • Mantra: Mantra API object instance.
  • options: object with the following properties:
    • path: <full path to files to check>,
    • seconds: <seconds old of files to be removed>

Exceptions:

If anything goes wrong during the removing process, then an exception is thrown.

Example:

await Mantra.api.oldfilesremover.remove( { path: "/etc/tmp/myapptemp", seconds: 100 });

Removes all files inside "/etc/tmp/myapptemp" older than 100 seconds.

async Mantra.api.oldfilesremover.deepremove( Mantra, options )

The same ahdn remove method but scans all folders and subfolder nested and check old files. If a folder completes with no files, then it is removed as well.