Skip to content

Instantly share code, notes, and snippets.

@cschell
Created August 8, 2014 09:34
Show Gist options
  • Save cschell/086867e61d87ec6a2bf4 to your computer and use it in GitHub Desktop.
Save cschell/086867e61d87ec6a2bf4 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