From c5c35c69d0f3871d98e14cedd7ee04a6576340b8 Mon Sep 17 00:00:00 2001 From: SammysHP Date: Sat, 25 Aug 2018 15:36:31 +0200 Subject: [PATCH] Fix deletion on server Previously random files were deleted on the ftp remote because the requested list of files was not sorted. A simple sort by date is enough in this case because the directories are already named according to the date. --- myftpdumper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/myftpdumper.sh b/myftpdumper.sh index 51f9519..a3d28b3 100755 --- a/myftpdumper.sh +++ b/myftpdumper.sh @@ -260,7 +260,7 @@ upload() { # FTP: delete old backups info "Delete old backups on FTP..." - ftpfiles=$(exec_ftp "cd \"$FTP_DIR\"; nlist; exit") + ftpfiles=$(exec_ftp "cd \"$FTP_DIR\"; nlist; exit" | sort) ## filter files starting with a dot ftpfiles=( $(echo $ftpfiles | sed 's,\.[A-Za-z0-9_\/\.]* , ,g') ) ## find old backups -- GitLab