N
N
Nicholas2016-04-11 14:00:42
Asterisk
Nicholas, 2016-04-11 14:00:42

Removing old directories from FreePBX?

Good afternoon everyone, I ask for your help. For himself sooo little familiar with * nix.
There are several scripts on the Freepbx server, in short:
The first script cleans the database of old CDR records
The second one cleans the *.wav files themselves in the /var/spool/asterisk/monitor/%year%/%month%/day% folders
Now to the point , what to add to the script so
that it also cleans the empty folders themselves older than 91 days? records:

find /var/spool/asterisk/monitor/ -name "*.*" -type f -mtime +91 -print -delete >> /etc/asterisk/scripts/delrecord.log

I will be glad for any help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pcdesign, 2016-04-11
@VR4

find /var/spool/asterisk/monitor/ -type d -empty -exec rmdir {} \; # Удаляем пустые диры

This is how you clean up empty directories.

N
Nikolai, 2016-04-11
@VR4

pcdesign : Tweaked your answer a bit =)
Checked it works! Thanks a lot again!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question