npkill icon indicating copy to clipboard operation
npkill copied to clipboard

Filter with date

Open InsOpDe opened this issue 5 years ago • 1 comments

Feature Request. I would save a lot of time if I could automate the process of filtering and deleting the folders. Then I could automate it with my backup plan, i.e. first delete node_modules of old projects, then borgbackup.

Describe the solution you'd like another parameter which lets you filter (and/or delete) after a given number of days passed since the project has been touched. We could discuss whether the tool should look after the package.json or the youngest file in the node_modules folder (or the youngest file in the parent directory, aka project directory, of the node_modules folder).

You could use it like so:

npkill --filter-days-passed 50

It then shows only all projects which are older than 50 days

Describe alternatives you've considered using find ..

InsOpDe avatar Feb 18 '20 21:02 InsOpDe

Hi! Thanks for opening this issue.

Yeah! It’s a great idea. It’s actually a pending TODO (you can see it on the README.) It hasn’t yet been incorporated due to the ‘technical difficulty’ that you yourself mention.

Just as you said, calculating the last modification in the node_modules file isn’t enough, we have to analyse the rest of the project’s files, since this is what will really let us know how long it’s been since it was last worked on. Analysing each of a project’s files to obtain the last modification date is simpler in linux (can be done with find), but requires a little more work in windows os. Currently, the windows logic is written in go (files.service.go).

We’ve detailed the process here in case someone reads this and would like to start working on this :)

zaldih avatar Mar 31 '20 15:03 zaldih

I'm working on the feature of add "last working date of the project" atribute to results so when it is ready, this issue will be able to continue going forward

zaldih avatar Oct 10 '22 17:10 zaldih

Hey! What do you think should be named the parameter to filter by 'date/old'?

--sort date --sort old

zaldih avatar Nov 01 '22 21:11 zaldih