We can use the linux find command to remove files that are for example older than x days, below is the example,
Here is the command to remove files older than 5 days,
find /opt/pbxware/pw/var/spool/asterisk/monitor/* -type f -name '*.WAV' -mtime +5 -exec rm {} \;
find /opt/pbxware/pw/var/spool/asterisk/voicemail/* -type f -name '*.WAV' -mtime +5 -exec rm {} \;You can use this one to exclude a particular folder
find /opt/pbxware/pw/var/spool/asterisk/monitor/* -path /opt/pbxware/pw/var/spool/asterisk/monitor/206 -prune -o -type f -name '*.WAV' -mtime +5 -exec rm {} \;
find /opt/pbxware/pw/var/spool/asterisk/voicemail/* -path /opt/pbxware/pw/var/spool/asterisk/voicemail/t-206 -prune -o -type f -name '*.WAV' -mtime +5 -exec rm {} \;