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

**URL:** <https://forum.obsidian.md/t/script-to-copy-move-broken-image-links-after-moving-file-to-new-vault/27368>\
**Category:** Help\
**Tags:** url-scheme, internal-links\
**Created:** [November 19, 2021, 3:32pm UTC](https://forum.obsidian.md/t/script-to-copy-move-broken-image-links-after-moving-file-to-new-vault/27368 "2021-11-19T15:32:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marouk\_d](https://forum.obsidian.md/user_avatar/forum.obsidian.md/marouk_d/32/22248_2.png) [@marouk\_d](https://forum.obsidian.md/u/marouk_d)\
**Post date:** [November 19, 2021, 3:32pm UTC](https://forum.obsidian.md/t/script-to-copy-move-broken-image-links-after-moving-file-to-new-vault/27368/1 "2021-11-19T15:32:02Z")

</div>

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](https://forum.obsidian.md/t/get-all-uploaded-files-in-roam-research-to-obsidian/13573/2).

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!

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [December 19, 2021, 3:32pm UTC](https://forum.obsidian.md/t/script-to-copy-move-broken-image-links-after-moving-file-to-new-vault/27368/2 "2021-12-19T15:32:10Z")

</div>

Closed on December 19, 2021, 3:32pm UTC

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