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?

A.B.
  • 89,123
  • 21
  • 245
  • 323
Aquarius Power
  • 3,921
  • 6
  • 39
  • 67

1 Answers1

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.

mikewhatever
  • 32,243
  • 10
  • 87
  • 98
  • 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! – Aquarius Power Apr 09 '16 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: http://superuser.com/a/552606/157532 – Aquarius Power Apr 09 '16 at 21:28