Batch delete users and the content they created When I received this Drupal 7 site to manage, it has had years of being open for people to make accounts and now I have ~ 300 PAGES of users with names like ismehacker1234568 and such, with under a dozen legitimate accounts I need to keep.
Once, on another site long ago I tried removing the users from the database table using a SQL query.  That was a disaster and broke the entire site.  I want to avoid that this time around.
I also need to delete any content they made, but not anything the legitimate users made.
As stated in the comments, Views Bulk Operations provides helpful functionality. You can use the &quot;select all&quot; checkbox on the /admin/people page to select all the users, then deselect the few you want to keep. From the dropdown, you can then choose &quot;Cancel user account&quot;. After submitting, you will select the method by which to cancel the accounts in bulk (such as Delete the account and its content, or Delete the account and make its content belong to Anonymous).