trash-cli icon indicating copy to clipboard operation
trash-cli copied to clipboard

trash-empty: option to only empty files trashed prior to application start

Open chapmanjacobd opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

When trash-empty runs for a long time it's possible that files are deleted sooner than expected (trash-empty running concurrently to a process which uses trash-put).

This might seem like a rare edge-case but in my workflows it is an hourly occurrence. It defeats the purpose of a recycle bin if the files are deleted prior to me running trash-empty for the next batch of files.

Describe the solution you'd like

I imagine that you could modify the DeleteAccordingDate class to check against a module const. For example:

APPLICATION_START = datetime.now(tz=timezone.utc).timestamp()

If something is trashed after APPLICATION_START, then Emptier would ignore that file.

Describe alternatives you've considered

Of course, I could run trash-empty less often, but the context here is an automated workflow and trash-cli fits in very well with the exception of this issue and this seems like it would be an easy fix.

Additional context

trash --version
0.22.10.20

chapmanjacobd avatar Oct 24 '23 16:10 chapmanjacobd