[Samba] vfs_recycle folder limit management

Thomas Harold thomas-lists at nybeta.com
Thu Sep 26 21:48:04 MDT 2013

On 9/26/2013 10:24 AM, Kevin Field wrote:
> Thanks John, but I meant more so is there a way to have it look at the
> total size of the recycle dir too?  I.e. only delete stale files when it
> needs to to stay within a limit, and also even delete not-so-stale files
> if it needs to because there have been too many GB deleted lately to
> keep 30 days worth (or whatever) around?

The easiest way would be to do a for loop in bash that starts at say 90 
days, does the "find/remove" command at the 90+ day mark, then checks 
the output of "du -cks /path/to/recycle/bin".  Once you get below the 
target kilobytes, you break out of the loop.  Otherwise you lower your 
target mtime value (by 1 or by 7), delete some more files, and check again.

So nothing in the recycle bin would be older then 90 days, and it would 
always stay below your target size.

More information about the samba mailing list