Deleting user images when using the rails console to delete users

I added over 17000 users to my client’s Discourse installation via the API. I have to delete them now because reasons.

I’ve worked out how to delete the users themselves via the Rails app as explained here: Bulk delete suspended users after import

This doesn’t seem to delete the user avatar pictures (unless Discourse is caching them?) so I was wondering if anyone can tell me where I can go in the DigitalOcean droplet to delete the images?


They’ll get deleted eventually. A process runs and moves unlinked images to a “tombstone” directory and then they get deleted 30 days later.


Oh cool. 30 days might be a bit long but that’s good to know.

Thanks AGAIN Jay! :smiley:

(Just for my own curiosity, what’d happen if one were to manually delete images from the Tombstone folder?)

1 Like

It would be deleted and you couldn’t decide later that you want it back. Avatars ain’t that big, so it wouldn’t seem like a huge problem.

I think it is not 30 days. We have site setting for that as clean_orphan_uploads_grace_period_hours (default 48).

I’m pretty sure that clean_orphan_uploads_grace_period_hours is how long before stuff gets moved to the tombstone folder (e.g., What happens if I manually move images out of the tombstone directory?)

It becomes a bigger problem when you realize that 17000+ avatars takes up around 2.5 gigabytes of space… :wink:

I see. You might do a ./launcher cleanup to get back some space from Docker.

1 Like

You are right @pfaffman. Clean up job removes it from database only. :+1: