Open chapmanjacobd opened 9 months ago
You can put a check at the beginning of DeleteAccordingDate.ok_to_delete(). Something like:
if parse_deletion_date(contents) >= application_start:
return False
But you should also consider the case when parse_deletion_date() returns None. The application start can be detected in EmptyAction.run_action() at can be passed as a parameter to the emptier.do_empty() function.
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: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