Is there anyway of doing this?
thanks…
Is there anyway of doing this?
thanks…
I came upon this code some time ago.
Run it at intervals (I run mine weekly) with cron
#!/usr/bin/perl
$dir = “/var/spool/asterisk/voicemail”;
$context = “default”;
$age = 31;
$unheardage = $age;
if($age==$unheardage) {
system(‘find ‘.$dir.’/’.$context.’ -name msg???.??? -mtime +’.$age.’ -exec rm {} ; -exec echo Deleted {} ;’);
} else {
system(‘find ‘.$dir.’/’.$context.’ -path ‘INBOX’ -prune -o -name msg???.??? -mtime +’.$age.’ -exec rm {} ; -exec echo Deleted {} ;’);
if($unheardage > 0) {
# Delete things that are in a folder called INBOX after $unheardage days
system('find '.$dir.'/'.$context.' -path \'*INBOX*\' -name msg????.??? -mtime +'.$unheardage.' -exec rm {} \; -exec echo Deleted {} \;');
}
}
$start = “0”;
$fnbase = sprintf “msg%04d”, $start;
$dir.="/".$context;