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:
- -atime +15 : means olders than 15 days you can change the +15 value to +10, +30 etc..
- althought you may change the time those cron jobs are launched: 39 2 * * * means everyday at 2:39 am (man crontab for more infos)
2) EXPAND /etc/crontab
/sbin/e-smith/expand-template /etc/crontab
3) DONE!
4) TO DO
- Build a rpm with a pannel
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