I have a backup ftp server and I have a CRON bash sending all backups here.
Right now I have to manually delete all old files, but I would like to automate this process with a CRON bash
The remote FTP does'nt have date on files (I don't know why), but backups are named by date (%Y-%m-%d-%H-%M-%S).
I thought of listing all files in the directory, sorting them by name and deleting all files with index > X but I don't know how to do that
My current code is :
ftp -inv $ftphost << EOF user $ftpuser $ftppass put $savepath.bz2 mysql/"$dbname"/"$datum".sql.bz2 bye EOF