Skip to content

Instantly share code, notes, and snippets.

@ohhdemgirls
Created February 1, 2014 20:19
Show Gist options
  • Save ohhdemgirls/8758179 to your computer and use it in GitHub Desktop.
Save ohhdemgirls/8758179 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Quickly delete all traces of a user from the database and filesystem
# usage: ./deluser.sh username
USER=$1
USERID=`sqlite3 ../database.db "select id from users where username = '${USER}'"`
for table in albums comments images posts; do
sqlite3 ../database.db "delete from ${table} where userid = ${USERID}"
done
sqlite3 ../database.db "delete from users where id = ${USERID}"
rm -r ../content/${USER}/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment