Zip a directory but exclude certain folders, but why?
I wanted to backup my WordPress site but exclude the backups folder, so this command came in handy.
zip -r /home/mysite/backups/backup.zip /home/mysite -x /home/mysite/backups/**\*
For the database backup I exported it as a sql file using WP-CLI.
wp export db
The zip file then can be transferred using SCP.
scp /home/mysite/backups/backup.zip [email protected]:/tmp/ scp /home/mysite/database.sql [email protected]/tmp/
Relocate the zip file and database.
mv /tmp/backup.zip /home/newsite/ mv /tmp/database.sql /home/newsite/
Import Database.
wp import db database.sql
Search-Replace.
wp search-replace 'mysite.domain' 'newsite.domain' --skip-guid=columns
Done.
Congratulations, now check it all works.
You must log in to post a comment.