July 24, 2021

How To Backup a Wordpress or Any Static Website

Today my girlfriend fiance wanted to backup an old blog of hers that was hosted on wordpress. There are many tools and applications that you can use but using wget you can download all the static files with a simple command line tool.

WEBSITE=https://jonathanhinds.com

wget \
  --convert-links \
  --backup-converted \
  --adjust-extension \
  --recursive \
  --level 10 \
  --page-requisites \
  --timestamping \
  --force-html \
  --restrict-file-names=windows \
  --no-host-directories \
  $WEBSITE

This will download all the static files and update the base urls for links so they still work when run locally. Additionally you can run this as many times as you want and it will only update files that have been updated since the last download. Enjoy!