Skip to content

Instantly share code, notes, and snippets.

@juanboterotech
Created February 12, 2026 18:34
Show Gist options
  • Select an option

  • Save juanboterotech/76409519a4f5af3164051d50ab301d88 to your computer and use it in GitHub Desktop.

Select an option

Save juanboterotech/76409519a4f5af3164051d50ab301d88 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Define WordPress folder, customizeit to your path
wordpress_folder="/home/username/www/wordpress"
backup_folder="/home/username/backup_folder"
current_date=$(date +"%d-%m-%Y")
# Create tar.gz from wordpress folder and save it to the desired folder
# Customize path to your PRIVATE backup folder
cd "$backup_folder" || { echo "Error: backup_folder does not exist"; exit 1; }
tar -czvf "wordpress-${current_date}.tar.gz" "$wordpress_folder"
echo "Backup task done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment