# Move topics from one Discourse instance to another

**URL:** https://meta.discourse.org/t/move-topics-from-one-discourse-instance-to-another/38930
**Category:** Self-Hosting
**Tags:** how-to
**Created:** [February 2, 2016, 10:11pm UTC](https://meta.discourse.org/t/move-topics-from-one-discourse-instance-to-another/38930 "2016-02-02T22:11:02Z")
**Posts on this page:** 1
**Showing post:** 65

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [August 20, 2026, 7:16pm UTC](https://meta.discourse.org/t/move-topics-from-one-discourse-instance-to-another/38930/65 "2026-08-20T19:16:58Z")

</div>

I’ve been wanting to solve the upload migration problem for just about forever, and now with AI chatbot help have gotten there. Sharing my notes for those who follow! Jay’s [post above](https://meta.discourse.org/t/move-topics-from-one-discourse-instance-to-another/38930/62) contained the special sauce needed to get me started so thanks for that.

My first pass at this worked exactly as Jay predicted. If you create a list of urls to the images on the site you are moving from and paste that into a post on your new site, they will be downloaded. `Download remote images to local` must be enabled for this to work.

My AI chatbot created a script for that which I’ll share here for future travelers.

> **Summary**
>
> Run this in the rails console:
> 
> ```plaintext
> topic = Topic.find(=TOPIC_ID=)
> posts = Post.where(topic_id: topic.id)
> urls = []
> 
> posts.each do |p|
> UploadReference.where(target: p).each do |ref|
> urls << "=SOURCE_URL=#{ref.upload.url}"
> end
> end
> 
> puts urls.uniq.join("\n")
> puts "\nTotal: #{urls.uniq.count} upload(s)"
> 
> ```
> 
> > 💡 **Moving a whole category instead?** Replace the first two lines with:
> > 
> > ```plaintext
> > topic_ids = Topic.where(category_id: =TOPIC_ID=).pluck(:id)
> > posts = Post.where(topic_id: topic_ids)
> > 
> > ```
> > 
> > In this case =TOPIC\_ID= is your category ID, found at the end of its URL in Admin → Categories.

However for me that ended up not being good enough because I also have PDFs which do not get downloaded to local automatically.

So I had my chatbot write me a python script to migrate the uploads. It works quite well so happy to share it as well. If you’d like to try it or have feedback, [here’s the repo](https://git.digitallysovereign.org/tobias/discourse-upload-migrator).

I also had my chatbot write me a more complete runbook on moving topics or categories, which is up on [my discourse](https://digitallysovereign.org/t/move-topics-or-categories-between-discourse-instances/742?u=tobias).

---

_[View the full topic](https://meta.discourse.org/t/move-topics-from-one-discourse-instance-to-another/38930)._
