find and remove files older that 7 days
find /path-to-folder/ -name "dbname_*".sql -mtime +7 -exec rm {} \;
database backup in compressed form:
ldir=$(mysqldump --routines --single-transaction -u user -ppassword dbname | gzip > /path-to-folder/dbname_`date +"\%Y\%m\%d\%H\%M\%S"`.sql.gz);
find and remove files older that 7 days
find /path-to-folder/ -type f -a -mtime +30 -exec rm {} \;
find /path-to-folder/ -name "dbname_*".sql -mtime +7 -exec rm {} \;
database backup in compressed form:
ldir=$(mysqldump --routines --single-transaction -u user -ppassword dbname | gzip > /path-to-folder/dbname_`date +"\%Y\%m\%d\%H\%M\%S"`.sql.gz);
find and remove files older that 7 days
find /path-to-folder/ -type f -a -mtime +30 -exec rm {} \;