Script to copy/move broken image links after moving file to new vault?

I have images stored in vault1/_attachment/img. When moving files from vault1 to a new vault2, the image links are broken (moved the files via native file explorer, since as far as I know there is no way to do move files between different vaults in Obsidian).

I’m looking for a script similar to the one I used when downloading local images from Roam.

I see two options:

  1. Copy over everything in vault1/_attachment/img to vault2/_attachment/img, but then of course I’m left with a lot of unused images and increased vault size (the script could just delete unused images) or
  2. Find all the images in the new vault2 vault and copy the image over.

If someone has already been through this I would be grateful for the help!

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