binarykitchen / find-remove

recursively finds files by filter options from a start directory onwards and deletes these. useful if you want to clean up a directory in your node.js app.
https://npmjs.org/package/find-remove
61 stars 19 forks source link

Support regular expression matching for files and directories #30

Closed pzhine closed 3 years ago

pzhine commented 3 years ago

delete all files that match a regular expression

var result = findRemoveSync(rootDirectory, { files: 'example[1-3]', regex: true })

this deletes files example1.txt, example2.txt, and example3.txt, but not example8.txt.

delete all directories that match a regular expression

var result = findRemoveSync(rootDirectory, { dir: '^assets_', regex: true })

this deletes all directories that start with assets_.

Fixes #9