Can I delete the resources folder?

I run the Windows desktop version and I do not sync (Sync Target is set to None).
My resources folder has grown to some GBs and I was wondering if I can remove the folder/contents since all the notes are already being compacted inside the sqllite database.
Would that make me lose notes or pose other issues?

In any case what is the use of the resource folder if all the notes are already inside the database?

1 Like

The short answer is no, you cannot safely delete the resources folder. Someone more knowledgeable can explain why, but in the interim, do not delete the folder or its contents.

Only note text is in the database. Everything else, e.g. attached images, documents, etc. are in the resources folder, so if you remove the folder, you will lose all of those files.

Howver if you export a folder in JEX format, does the exported file it include those resources, like images, too?

AFAIK JEX exports everything except note history (i.e. former versions of your notes which is set to 90 days as a default value).

Why don't you start as follows

  • create a full backup (just in case)
  • open Joplin
  • goto menu -> tools -> note atachments
  • sort by size (big files on top)
  • delete all the attachments at once OR
  • delete just one big attachment
    go back to the Joplin main window and look for unwanted consequences.

If you want to clean up attachment resources that are no longer used, you can use the visualization tool developed previously: joplin-batch-web.

https://joplin-utils.rxliuli.com/joplin-batch-web/

menu -> tools -> note atachments
sort by size (big files on top)

Is there an easy way to identify the note containing each attachment, i.e., easier than seeing the attachment, and then going back to the note list and running a search for terms based on the attachment?

@jb261

As stated above, your database contains your note text, note metadata, tags data, notebook data and resources metadata. The actual resources (attached files) are stored in the Resources folder.

Advice:

  • Do not delete the Resources folder. You will lose all your attachments.
  • Do not delete files from the Resources folder using your OS file manager / command line. It is unlikely you can be certain that the file is not being referenced by a note or by a note in your note history.
  • Do not delete files using the Note Attachments screen in Joplin. It is unlikely you can be certain that the file is not being referenced by a note or by a note in your note history.

Joplin should clean out old attachments when they are no longer being referenced by a note or by a note in the note history, however sometimes some do get missed. By far the safest way to clear out any unused resources (attachments) is to use Joplin Batch Web as @rxliuli says above. It works locally in your browser, finds any attachments that are not referenced at all in your database, and allows you to delete them.

Yes. The JEX export file is just a TAR file wrapping up the result of a RAW - Joplin Export Directory export into one file. If you do a RAW export you will be able to see what the JEX file contains. You could also open the JEX file in an archive manager that handles TAR files (just don't edit it if you may later need to use it).

2 Likes

What if you want to de-bloat the resources by checking over the largest note attachments and seeing if you still want the associated notes? What is the easiest way to identify the notes referencing the files we see in the Note Attachments screen?

As I looked into the code handling note deletion, I didn't see any code that deletes resources when a note is deleted. I tested it and indeed, the image in the note stays in the resources directory after I deleted the note.

My modified version (that keeps markdown files), when a note is deleted, besides deleting the resources with the files, there is also the code that would delete the resources in Joplin's config directory, but so far I have yet enabled this part yet. Will probably just enable it in the next upload.

Is this the case when note history is enabled or disabled? Resources should only be deleted when the specific note's history "expires".

1 Like

And, in addition to what @tomasz86 said, from what I have read on this forum I have always believed it to be run as a "housekeeping" routine rather than directly linked to the deletion of a note. I'm not a code guru so I could be wrong.

EDIT:

The below is a post by Laurent, admittedly it's a bit old, giving insight into the method for deleting unused resources.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.