#!/bin/bash TO=/backup/site/ FROM=/root/docker_app/public/help/ DAY=30 tar -vczf $TO`date "+%d-%m-%g_%H-%M-%S"`-site.tar.gz $FROM ls $TO -t | tail -n +$DAY | xargs rm ls -lt $TO exit 0