Script for changing a voicemail file


I need a script connected to a custom extension. This script has to check if there is a file named temp.WAV in /var/spool/asterisk/voicemail/default/nnn [nnn is extension number]. I the file exists it has to be renamed to rtemp.WAV. If the file does not exists, then the file rtemp.WAV has to be renamed to temp.WAV.

Thank you very much for every answer!


briefly wher f0 is one file and f1 the other:-

if [ -f f0 ];then mv f1 f0 ;else mv f0 f1;fi