24 lines
584 B
Bash
24 lines
584 B
Bash
#!/bin/sh
|
|
#
|
|
# simple shell script to clean some subdirectories of a maildir
|
|
#
|
|
# format of $etcfile is:
|
|
# dirname1,maxdays
|
|
# dirname2,maxdays
|
|
# etc...
|
|
# (one line by subdir to clean)
|
|
#
|
|
# were dirname* is the name of the subdirectory to clean,
|
|
# and maxdays is the maximum number of days before a message is deleted
|
|
#
|
|
# put it in the user's crontab:
|
|
# 50 * * * * /path/to/cleanmaildir.sh
|
|
|
|
etcfile=/etc/cleanmaildir.conf
|
|
|
|
for i in `cat $etcfile`
|
|
do
|
|
dir=`echo $i | cut -f 1 -d ,`
|
|
time=`echo $i | cut -f 2 -d ,`
|
|
find ~/Maildir/$dir/cur/* -mtime +`expr $time - 1` -exec rm '{}' \;
|
|
done
|