Skip to content

Instantly share code, notes, and snippets.

@ko31
Created July 15, 2023 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ko31/1d1dd6cf6d171500706eddf63ed18934 to your computer and use it in GitHub Desktop.
Save ko31/1d1dd6cf6d171500706eddf63ed18934 to your computer and use it in GitHub Desktop.
Shell script to export the backup file using the WP-CLI command of All-in-One WP Migration
#!/usr/local/bin/bash
# Set backup directory
BACKUP_DIR=/path/to/wordpress/wp-content/ai1wm-backups/
# Change directory to the WordPress
cd $BACKUP_DIR
# Run the wp-cli command to export the backup file
wp ai1wm backup
# Delete backup files older than seven days
find ${BACKUP_DIR}*.wpress -type f -mtime +7 -exec rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment