Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple way of backing up one or multiple Tumblr blogs to date-prefixed folders; downloads and removes required software (except Python) automatically.
# BLOGS is a space-separated list of the blogs you want to backup. You can omit
# the "" part if you want.
# OUT is the directory where the backups will be stored. For each blog, a date-
# prefixed subdirectory will be created here.
# TEMP is the directory where the required software will be cached. It will be
# created and removed automatically.
# OPTIONS is a space-separated list of options passed to for
# all blogs. This feature is intended for experienced users. Refer to
# for a listing of all options or take a look at these examples:
# Only backup the newest 42 posts: --count=42
# Only backup posts from the current year: --period=y
# Backup a password-protected (private) blog: --private=YOUR_PASSWORD_HERE
# Only backup posts tagged "selfie": --tags=selfie
# Only backup posts tagged "trek", "wars" or "gate": --tags=trek,wars,gate
# Only backup text posts: --type=text
# Only backup video and audio posts: --type=video,audio
# Everything below this line should just work™.
# the cleanup function needs to be defined at the top so we can call it whenever
# the user chooses to abort
function tb_clean_up {
printf "Cleaning up... "
rm -r "$TEMP"
printf "done\n"
exit $1
# setup
printf "Setting environment up... "
trap "tb_clean_up 1" INT
printf "done\n"
# download required software
printf "Downloading required software... "
mkdir -p $TEMP
if [ -n $(command -v curl) ]; then
curl -sS "" > "$TEMP/"
curl -sS "" > "$TEMP/tumblr_backup"
wget -qP "$TEMP/" ""
wget -qO "$TEMP/tumblr_backup" ""
chmod 744 "$TEMP/tumblr_backup"
printf "done\n"
# this is where the magic happens
for BLOG in $BLOGS; do
if [ -n "$OPTIONS" ]; then
tumblr_backup $OPTIONS --outdir "$OUT/$(date +%F)_$BLOG" $BLOG
tumblr_backup --outdir "$OUT/$(date +%F)_$BLOG" $BLOG
# clean up
tb_clean_up 0

This comment has been minimized.

Copy link

@wtadesign wtadesign commented Nov 10, 2014

Quick question is there a way to specify a start and end date for the backup? (for future backups)
So you don't need to backup the whole blog again only to the last previous backup date.
Thanks for this script, works great.


This comment has been minimized.

Copy link
Owner Author

@doersino doersino commented Dec 17, 2014

Late answer: does provide both an incremental backup mode and an option to limit the backup to some period of time, however I consciously limited the capabilites of for simplicity's sake.

I'll probably add a way to pass an option string to soon, though, as well as some examples.

Edit: Done. Use OPTIONS="--period=y" to only backup posts from the current year or OPTIONS="--period=2013" to only backup posts from 2013. Take a look at for more options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment