How to batch-delete one’s tweets

We assume sferik’s t command line client is installed and attached to a specific account (to attach the client you need an app that you can create on apps.twitter.com. Then the command is t authorize).

We can delete a post (knowing its id) doing

t delete status -f 318635511294070784

We can get the id by requesting a Twitter archive in the account settings. It’s quite nifty — it comes with an index.html file that allows you to browse your tweets. What we are interested here are the data files, eg

tweets/data/js/tweets/2016_11.js

We can extract the ids using the following egrep command (what it really does is to write the delete commands into a file called run). The lines below then count the tweets, and execute the deletes.

egrep '^  "id_str"' 2016_11.js|egrep -o '[0-9]{18}' | while read x; do echo "t delete status -f $x | tee -a logfile"; done > run
wc -l run
chmod +x run
./run

The particular set of commands above would delete all tweets for November 2016. For other months, the filename (2016_11.js) must be adjusted.

NOTE: THOSE DELETES ARE FINAL!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.