Hi all!
I have to clean the voicemails from asterisk, but I want to keep at least, the voicemails for five days.
I started writing a script, but I'm a bit stuck, and I've trying somethings for sometime, but still I can't get it
The hierarchy of Asterisk Voicemails is like this:
- default
- 10000
- INBOX
- msgbox0001.txt
- msgbox0001.wav
- msgbox0002.txt
- msgbox0002.wav
- 10004
- INBOX
- msgbox0001.txt
- msgbox0001.wav
- msgbox0002.txt
- msgbox0002.wav
- 10040
- INBOX
- msgbox0001.txt
- msgbox0001.wav
- msgbox0002.txt
- msgbox0002.wav
etc...
I did a
Code:
cat default > folderlist
to have all the names of the folders
Then I thought that I could do a while loop like this
Code:
while read line
docd var/spool/asterisk/voicemail/default/$line/INBOX
pwd # this is just for testing that works
done < folderlist
But I don't know how I can compare dates for deleting only the voicemails that are older than 5 days.
:S
Thanks for your helping, I really aprecciate it
Thanks again