🌱 Remove old files
ls -r1 $PT_MYSQLBACKUPPATH/ | tail +$(($PT_FILESTOKEEP+1)) | xargs rm
ls -r1will list all files in reverse order, one file per line.tail +$numberfilters the first $number-1 files of the list out (resp. displays all files beginning from $number till the last one).xargswill executermwith all file names from standard input.