Documentation > How-to Classification > Samba > How to clean up files older than X days from the "Recycle Bin" directories


About this HowTo

Authors: Laurent Dinclaux
Tested on: SME Version 6.5 RC1 only
Created: 25 Aug 2005
License: GPL
Summary: This HowTo enable you to set up a cron job that delete files older than x days from samba "recycle Bin" folders
Keywords: samba, recycle bin, recycle, .recycle, older than, crontab, cron
Certification: Contribs.org in progess here


1) CREATE NEW CRONTAB TEMPLATE

pico /etc/e-smith/templates/etc/crontab/25clearRecycleBins


Paste the following:

# Delete files older than X days from all Recycle Bin directories
39 2 * * * root find /home/e-smith/files/*/*/*/Recycle\ Bin -type f -atime +15 -exec rm \{\} \;
39 1 * * * root find /home/e-smith/files/*/*/Recycle\ Bin -type f -atime +15 -exec rm \{\} \;
39 3 * * * root find /home/e-smith/files/*/*/*/Recycle\ Bin/* -type d -empty -print -exec rmdir '\{\}' \;
39 4 * * * root find /home/e-smith/files/*/*/Recycle\ Bin/* -type d -empty -print -exec rmdir '\{\}' \;


Quit and save the file (ctrl+x and then answer yes to save the file)

NOTE: Here is what you can change in those lines:

2) EXPAND /etc/crontab

/sbin/e-smith/expand-template /etc/crontab


3) DONE!


4) TO DO



Documentation > How-to Classification > Samba > How to clean up files older than X days from the "Recycle Bin" directories

Add your comments about this How To