Mysql backup and delete older files

We were taking mysql backups using a very simple shell script which was using mysqldump as below.

#!/bin/sh
#echo "Starting the script";
HOST=localhost
USER=myDBUser
PASSWD='myPassword';

# create directory if it doesn't exist
OLDBACKUP=/home/my_backup/sql_files
if [ ! -d "$OLDBACKUP" ]; then
# create direcotry
mkdir /home/my_backup/sql_files
fi

# set file names by appending date to each file
dbName=dbName-`date -I`.sql;

# take db backups
mysqldump -u $USER -p$PASSWD -n -c myDbName >  $dbName;

# move the file to sql_files directory
mv $dbName $OLDBACKUP

We were keeping old backup files but we knew that we would need to remove the backup files older than two weeks or a month. I was thinking what to do and after some studying I found the following one line, would help us remove files older than x number of days.

find /home/my_backup/sql_files -type f -mtime +15 | xargs rm

Where 15 could be changed to any number of days and it will remove all the files older than that number of days recursively, using this command. This command won’t delete any special files or sub directories.