# Bulk delete suspended users after import

**URL:** https://meta.discourse.org/t/bulk-delete-suspended-users-after-import/73011
**Category:** Support
**Created:** [29.Октябрь.2017 17:53:32 UTC](https://meta.discourse.org/t/bulk-delete-suspended-users-after-import/73011 "2017-10-29T17:53:32Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [30.Октябрь.2017 02:52:30 UTC](https://meta.discourse.org/t/bulk-delete-suspended-users-after-import/73011/3 "2017-10-30T02:52:30Z")

</div>

For that, you should enter into the container with

```shell
./launcher enter app

```

Then, you will need to launch the [rails console](http://guides.rubyonrails.org/command_line.html#rails-console) with

```shell
rails c

```

Once you’re in the rails console, you can delete all suspended users who have zero posts and topics with

```ruby
User.joins(:user_stat).where("users.suspended_at IS NOT NULL AND user_stats.topic_count = 0 AND user_stats.post_count = 0").destroy_all

```

_Always make sure you have latest db backup whenever you run `destroy_all` method._

---

_[View the full topic](https://meta.discourse.org/t/bulk-delete-suspended-users-after-import/73011)._
