Closed garycjohnson closed 6 years ago
Ah, interesting bug. Just published a fix for that on npm. Try to update and test again. And lemme know.
Thanks @binarykitchen ... looks good ... loved the fast turnaround. I've taken this version now and working as expected.
great, thx for the feedback too
Compare these two calls:
FINDREMOVE(OS.tmpdir(), { extensions: [ '.pdf' ], maxLevel: 2 })
Returns an empty object {}FINDREMOVE(OS.tmpdir(), { extensions: [ '.pdf' ], maxLevel: 2, age: { seconds: 1800 } })
Throws an exception: Error: EACCES: permission denied, unlink '/tmp/.log-publish-records/_var_log_aws-sqsd_default.log-20180826.gz' at Error (native) at Object.fs.unlinkSync (fs.js:1104:18) at rimrafSync (/var/app/current/node_modules/rimraf/rimraf.js:297:17) at /var/app/current/node_modules/rimraf/rimraf.js:332:5 at Array.forEach (native) at rmkidsSync (/var/app/current/node_modules/rimraf/rimraf.js:331:26) at rmdirSync (/var/app/current/node_modules/rimraf/rimraf.js:324:7) at Function.rimrafSync [as sync] (/var/app/current/node_modules/rimraf/rimraf.js:295:9) at module.exports (/var/app/current/node_modules/find-remove/find-remove.js:176:28) at /var/app/current/node_modules/find-remove/find-remove.js:157:34
It seems that by adding the
{ age }
property the module tries to delete files that it wouldn't otherwise care about.Expected behaviour: Adding
{ age }
property further limits the find based on the age of the files.