Skip to content

Instantly share code, notes, and snippets.

@eignatov
Forked from cschell/delete_old_backups.sh
Created February 5, 2020 19:41
Show Gist options
  • Save eignatov/de957b7b45713ec8a1f4d26223d47479 to your computer and use it in GitHub Desktop.
Save eignatov/de957b7b45713ec8a1f4d26223d47479 to your computer and use it in GitHub Desktop.
Delete backups that are x days old (from ftp server)
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+%Y-%m-%d_'`*; exit"
# make sure to escape % for cron:
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+\%Y-\%m-\%d_'`*; exit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment