Backup download from server

Keywords´╝Ü linux


So, i have a situation. I have some databases, files etc on a server. Crontab is in charge to backup files and databases. Problem is that server gets full quickly, and i need to download backups and delete them. Not a huge deal, but, there will be more systems on that, and other servers, and i will not be able to track and maintain free space. So. I need shell script to download files to my local machine, and delete backups from server. But, with small caveat. If, lets say, on server are 20 backups in the monent, shell neds to download and delete only 10 oldest and leave 10 newest... So, when there are 20 backups, delete ten, whait to get another ten, then delete ten oldest and so on. I hope i was clear. :)