3

I am talking about the .Trash-1000 folders like.

Some times it's contents size reach like 18GB, and applications trying to write files will fail with no clear messages, because the disk space has ended.

I am looking for a way to force a trash quota/limit with some extra constraints.

These constraints options would be good:

  • by file date/time, older files are erased first.
  • by available disk space, if it has like less than 1GB, no matter what trash file datetime it is, it gets erased to keep 1GB available.
  • by file size, if trashed file is bigger than 500MB, it is promptly erased.

Is there such software sitting somewhere so I can avoid scripting it up?

1 Answer 1

2

Try autotrash from the repositories.

autotrash — program to automatically purge old files from the FreeDesk-top.org trash

Once installed, you'll need to add a cron job to run autotrash.
Run crontab -e, and add the following line:

@hourly /usr/bin/autotrash --keep-free 1024 -d 30

I don't think it covers the last point, but it's something to start with.

PS: Also check out man autotrash for more info.

2
  • interesting, I think it will do! I actually want to keep the max amount of trash possible, but always have good disk free space, still testing it thx! Apr 9, 2016 at 21:16
  • I think it works but it is unnecessarily slow. I sat here waiting something happens for about 5 min on a 3GB trash folder and nothing happened. It uses python, I think a more simple script using this answer in a loop with a work step of 100 entries would provide a much faster result: superuser.com/a/552606/157532 Apr 9, 2016 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .