How can I re-link media on my Canvas to their new locations, after moving local files to sub-folders?

What is the issue:

Just like many of you, my Obsidian vault has an “Attachments Folder”, where I used to keep all of my images — hundreds of files, all in one folder. So, after doing some file re-organizing outside of Obsidian, I’ve moved all of my images inside a series of sub-folders.

All of media-files are still named the same and located inside the same main folder, just now in separate sub-folders. For the sake of clarity, here’s some visuals:

  • Image-folder
    • file1.jpg
    • file2.jpg
    • file3.jpg

  • Image-folder
    • Sub-folder-1
      • file1.jpg
    • Sub-folder-2
      • file2.jpg
    • Sub-folder-3
      • file3.jpg

After that, Obsidian, as to be expected, have lost track of those images. Now, each media-card on my every Canvas looks like this:


What I’m trying to do:

I would like to find a way to “re-link” those cards to their associated files, hopefully without “Swapping Files” by hand.

What I have tried:

I’ve checked if the option in “Files & Links” called “Automatically update internal links” was turned on. It was, but it didn’t help.

I’ve also realised that Obsidian’s Canvas does update embedded media-files to their new location, but only if the move itself is done in Obsidian. But if the move is done through Windows file-explorer, Canvas fails to locate the new file-path.

I’ve also tried begging, crying and offering bribes, but so far my Obsidian doesn’t reward me with answers.

1 Like

Within Obsidian, you could try to move a few images back to their original folder (recreate the path if you have to), and check if they show up in the canvas cards. If they do, then move the same few back to your new desired folder. Does the location auto-update? If so, rinse and repeat with a larger group. :crossed_fingers:t3:

Seems to have worked! …But I also decided to ditch re-organizing those Attachments by sub-folders, returning to one single folder full of stuff — at least until I manage to find the solution for re-linking media without jumping though hoops xD

I think the trick is to re-organize within Obsidian, as you then will get the proper renaming of links and so on. Test with a few, and then start moving larger volumes of files.

Thanks, but I’m not sure it’s an option for me. I was aware that Obsidian is capable of re-linking media-cards to their new file-locations, but only when files are moved from within Obsidian. The issue is — I was doing my organizing through another app (called “Allusion”, for creating image-galleries), so re-doing all that process from Obsidian is not quite what I’m looking forward xD Plus, I would have to do this every time I use that app to add some new images.

I’m not sure what you’re level of script is like, but would it be an option to build a list of which files to move with origin and new place, and then use a script within Obsidian to actually move the files?

Or put another way, are you able to do a “soft-version” of the move within Allusion, where the output is the list of files you want to move and where you want to move then, and then do the actual move using a script in Obsidian?

I’m afraid it’s a bit too many steps for me. The general idea was that I could easily copy/paste images from the web onto Obsidian Canvas or Allusion Gallery and they would work together for my organising purposes. I could, technically, follow you plan, but this way I would spend more time syncing images to Obsidian then doing anything else :laughing:

So far I decided to just ditch multi-foldered structure and just return to singular attachments folder. Not perfect, but at least Obsidian doesn’t have to go looking for files :laughing:

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