Delete Recordings

Hello,
I know this has been talked about prior but we have a different folder structure then advised. With in the recording folder, each agent has their own folder. In their individual folder they have sub folders for each day labeled by day and month. With in each of those resides their recorded calls. I tried to auto deletion of .wav files as advised but it did not work. Any suggestions?

find /rootof/your recordings/ -mtime +30 -name *.wav -delete

Hello,
Thank you for responding and I have tried this and it doe snot work. That command seems to only look for the .wav files in that folder directory, we have sub folders that contain agent extensions as the name of the folder. Each agent has one. With in each agent folder they have a folder for each day of the month. In each of these folders has the .wav files.

Here is the directory path
/opt/osdial/recordings/completed/
With in here we have over 100 folders. example is
/opt/osdial/recordings/completed/100487/
With in this folder ( 100487) this agent has over 100 folders, one for each day for the last 2 years. In each of those folders has the .wav files of all their calls for that day

Lets start with bay steps, does :

find /opt/osdial/recordings/completed/

return a whole bunch of *.wav files?

Yes it does

Does

find /opt/osdial/recordings/completed/ -mtime -1 name *.wav

return todays calls?

Yes, it does have some from yesterday mixed in. But it does return essentially the last 24 hrs of calls

so we can assume that

find /opt/osdial/recordings/completed/ -mtime +60 name *.wav

will list all .wav files older than 6024 hours, correct?

At what age do you want to purge?

~]# find /opt/osdial/recordings/completed/ -mtime +60 name *.wav
find: paths must precede expression: name
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path…] [expression]

badly formatted by the forum

find /opt/osdial/recordings/completed/ -mtime +60 -name *.wav

Ok, that worked as intended. We are looking to purge anything older than 90 days

Now older versions of find need

find /opt/osdial/recordings/completed/ -mtime +90 -name *.wav -exec rm -rf {} \;

but modern ones you can

find /opt/osdial/recordings/completed/ -mtime +90 -name *.wav -delete

(my guess is you have a very old un-updated system)

I will try those to see what one works, this system is Freepbx 13 on Asterisk 11.13.0-53
We are in the process of upgrading the system but having almost 3 TB of recordings. This is why the purge for 90 days. Thanks for your help, I will post what worked for this system

1 Like

find /opt/osdial/recordings/completed/ -mtime +90 -name *.wav -delete

Worked and deleted the desired recordings. Thanks again for the help!

hehe, look remarkably like like my original post (which apparently “didn’t work” :slight_smile: )

find /rootof/your recordings/ -mtime +30 -name *.wav -delete

glad you got it fixed

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.