# Destroy missing upload topic

**URL:** https://meta.discourse.org/t/destroy-missing-upload-topic/201221
**Category:** Support
**Created:** [August 21, 2021, 4:17am UTC](https://meta.discourse.org/t/destroy-missing-upload-topic/201221 "2021-08-21T04:17:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chratec](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chratec/32/175969_2.png) [@chratec](https://meta.discourse.org/u/chratec)
#### Post date: [August 21, 2021, 4:17am UTC](https://meta.discourse.org/t/destroy-missing-upload-topic/201221/1 "2021-08-21T04:17:16Z")

</div>

Hi,  
I would like to take bulk action to delete all post with missing upload image:

```plaintext
> rake posts:missing_uploads
   70782 post uploads are missing.
   61037 uploads are missing.
   23249 of 216049 posts are affected.

```

```plaintext
> PostCustomField.where(name: Post::MISSING_UPLOADS).count
===> 23249

```

So I decide to delete all of them with below code on rails c

```plaintext
> rails c
> PostCustomField.where(name: Post::MISSING_UPLOADS).find_each do |post|
> PostDestroyer.new(Discourse.system_user, post).destroy
> end

```

But no luck with error show as below:

```plaintext
NoMethodError: undefined method `topic' for #<PostCustomField:0x000055dd7425e160>
from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activemodel-6.1.3.2/lib/active_model/attribute_methods.rb:469:in `method_missing'

```

I would like to looking for some help in this case to bulk destroy missing upload topic

Thank you,
