# \[Feature Request\] Place attachments in the same sub-folder when exporting

**URL:** <https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072>\
**Category:** Features\
**Created:** [14 January 2022 03:31 UTC](https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072 "2022-01-14T03:31:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![h1jfzpl5jdkmfbo](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@h1jfzpl5jdkmfbo](https://discourse.joplinapp.org/u/h1jfzpl5jdkmfbo)\
**Post date:** [14 January 2022 03:31 UTC](https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072/1 "2022-01-14T03:31:22Z")

</div>

It would be great if we can export attachments in the same folder where their notes are located. Currently, when we export, it creates two different folders.

- Notes - Contains the markdown files and sub-folders
- Resources - Contains the attachments

I think it would be great if we can export notes/notebooks like this:

```auto
- main_folder
--- sub_folder_01
------ note_01.md
------ image_01.jpg
------ document_01.pdf
--- sub_folder_02
------ note_02.md
------ image_02.jpg
------ document_02.pdf

```

---

<div class="post-metadata">

**Author:** ![whitewall](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/whitewall/32/6018_2.png) [@whitewall](https://discourse.joplinapp.org/u/whitewall)\
**Post date:** [14 January 2022 04:55 UTC](https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072/2 "2022-01-14T04:55:41Z")

</div>

Welcome to the forum!

---

<div class="post-metadata">

**Author:** ![joeldebruijn](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/joeldebruijn/32/1298_2.png) [@joeldebruijn](https://discourse.joplinapp.org/u/joeldebruijn)\
**Post date:** [14 January 2022 05:39 UTC](https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072/3 "2022-01-14T05:39:15Z")

</div>

I also really want to keep my notes content+attachment together, but in my case I dont use a resource twice.

Theoretically, is it possible to use a resource twice?  
And when exporting, would the consequence be that a resource is exported multiple times in every folder containing a note?

I wouldnt mind perse, tho.

---

<div class="post-metadata">

**Author:** ![h1jfzpl5jdkmfbo](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@h1jfzpl5jdkmfbo](https://discourse.joplinapp.org/u/h1jfzpl5jdkmfbo)\
**Post date:** [14 January 2022 06:18 UTC](https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072/4 "2022-01-14T06:18:19Z")

</div>

Personally, I think there should be a copy for each note. This way, even if we edit/tamper with the resource, other notes won't be affected.

The main downside to this is it will take up space. However, we can make use of prompts and linking for that.

If a user imports a resource that already exists in Joplin, the user will be shown a prompt. Something like this:

```auto
This resource already exists, please choose an option:
* Link the existing resource
* Import

```

If there are multiple same resource that exists in Joplin, the user should also be shown a picker to choose which one they want to refer to.

---

<div class="post-metadata">

**Author:** ![human314](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/human314/32/15751_2.png) [@human314](https://discourse.joplinapp.org/u/human314)\
**Post date:** [19 December 2022 13:44 UTC](https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072/5 "2022-12-19T13:44:07Z")

</div>

I really need this feature as well! I want to create backups of my notes that are usable without joplin.  
When I'm exploring my notes with a simple file explorer and text editors it would be really helpful to have the attachments in the corresponding folders.

---

<div class="post-metadata">

**Author:** ![Marph](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/marph/32/10800_2.png) [@Marph](https://discourse.joplinapp.org/u/Marph)\
**Post date:** [28 December 2022 15:36 UTC](https://discourse.joplinapp.org/t/feature-request-place-attachments-in-the-same-sub-folder-when-exporting/23072/6 "2022-12-28T15:36:02Z")

</div>

Since there seems to be no existing solution, you could take a try and implement it using [Joplins data API](https://joplinapp.org/api/references/rest_api/). However, there might be some obstacles, like spanning up a tree with all notebooks, notes and resources and handling duplicated notebook names. Also for reimporting, you would need to write another custom script.

**Edit** : I took a try and wrote a script without considering many corner cases. It works on linux for my Joplin profile (314 notes, 9 resources):

> <https://github.com/marph91/joppy/blob/master/examples/custom_export.py>
