# Export all studies from Postgres DB storage to Filesystem

**URL:** https://discourse.orthanc-server.org/t/export-all-studies-from-postgres-db-storage-to-filesystem/5463
**Category:** General
**Created:** [January 22, 2025, 6:06pm UTC](https://discourse.orthanc-server.org/t/export-all-studies-from-postgres-db-storage-to-filesystem/5463 "2025-01-22T18:06:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dnudelman](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/d/e5b9ba/32.png) [@dnudelman](https://discourse.orthanc-server.org/u/dnudelman)
#### Post date: [January 22, 2025, 6:06pm UTC](https://discourse.orthanc-server.org/t/export-all-studies-from-postgres-db-storage-to-filesystem/5463/1 "2025-01-22T18:06:02Z")

</div>

Setup an orthanc server about 2 years ago, at the time I thought saving the images in the DB would be the best option. I feel like id rather them be stored in the filesystem and just indexed in postgres. Is there a script around to export all of the studies to orthanc file system or is there a better way to go from postgres db stored images to filesystem stored images.

If there isn’t anything existing I will write something and report back but figured Id ask first.

---

<div class="post-metadata">

### Author: ![benjamin.golinvaux](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/benjamin.golinvaux/32/1508_2.png) [@benjamin.golinvaux](https://discourse.orthanc-server.org/u/benjamin.golinvaux)
#### Post date: [January 23, 2025, 5:48am UTC](https://discourse.orthanc-server.org/t/export-all-studies-from-postgres-db-storage-to-filesystem/5463/2 "2025-01-23T05:48:22Z")

</div>

Hello,

Since whatever method you will use will imply moving the bytes around anyway (thus incurring the transfer “cost”), wouldn’t it be easier for you to use a blue-green setup where you provision another Orthanc (possibly a disposable one), with its `StorageDirectory` pointing to the correct final location, and migrate all of your DICOM files to this new instance?

You could then, afterwards, switch the first Orthanc to use the DB and storage filled by the 2nd one.

If you cannot afford downtime and/or new instances might be pushed while the migration is taking place, maybe you can create a dynamic setup where your original Orthanc remains functional and available to users, with an [OrthancCloner](https://github.com/orthanc-team/python-orthanc-tools) container/script running on the side, that would gradually copy the files to the new Orthanc. Once migration is complete, you could switch them rapidly.

HTH

---

<div class="post-metadata">

### Author: ![dnudelman](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/d/e5b9ba/32.png) [@dnudelman](https://discourse.orthanc-server.org/u/dnudelman)
#### Post date: [January 23, 2025, 4:14pm UTC](https://discourse.orthanc-server.org/t/export-all-studies-from-postgres-db-storage-to-filesystem/5463/3 "2025-01-23T16:14:59Z")

</div>

I like this approach, Ill look into it more. thank you sir 😃
