# Mass close existing topics older than x?

**URL:** https://meta.discourse.org/t/mass-close-existing-topics-older-than-x/328214
**Category:** Support
**Created:** [September 26, 2024, 12:00pm UTC](https://meta.discourse.org/t/mass-close-existing-topics-older-than-x/328214 "2024-09-26T12:00:42Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Tealk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tealk/32/525923_2.png) [@Tealk](https://meta.discourse.org/u/Tealk)
#### Post date: [September 26, 2024, 2:23pm UTC](https://meta.discourse.org/t/mass-close-existing-topics-older-than-x/328214/4 "2024-09-26T14:23:42Z")

</div>

> [@Administrative Bulk Operations](https://meta.discourse.org/t/administrative-bulk-operations/118349/1):
>
> Close all topics created before a specified date (includes post action)
> 
> ```plaintext
> Topic.where(closed: false).where("created_at < '2015-01-01'").find_each do |topic| 
> topic.update_status('closed', true, Discourse.system_user)
> end
> 
> ```

Yes, there would be something similar linked, how can I narrow it down to one category?

---

_[View the full topic](https://meta.discourse.org/t/mass-close-existing-topics-older-than-x/328214)._
