ubuntu: how to zip files created on a specific month

I've got a couple of gigabytes of files created  daily by my Asterisk Server. This files are created on every call (asterisk records all calls) so the memory is full so I would like to create a monthly snapshot of all the files zip them and upload them to a remote server.

 

#To zip the files I use the following command

find '/var/spool/asterisk/monitor' -newermt '2016-05-01' ! -newermt '2016-06-01' -print | zip /var/spool/asterisk/monitor/2016-06.zip -@

 

#To delete the files I have zipped and moved to a remote server i use the following command.

find '/var/spool/asterisk/monitor' -newermt '2016-06-01' ! -newermt '2016-07-01' -print -exec rm {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *