This script is for FoundryVTT, it relinks images to entities if you manually move the images in the OS.
So I madew a BIG mistake without realizing it months ago...
I placed all of my assets (AKA images) inside my world folder... HUGE MISTAKE!
So I wanted to create a new game I could not access those folders and deleting the old world would have deleted everything I had done.
*** PLEASE BACKUP YOUR FILES BEFORE YOU USE THIS ***
So to solve this I needed to move my files... in the OS I COPIED the files into a new shared location.
If you want to create your own module remember to follow these instructions here: https://foundryvtt.com/article/compendium/
I placed my files in a shared location and then created a shared module using this templete: <This is not mine, not sure who to give credit to> https://cdn.discordapp.com/attachments/513918036919713802/742088775068549200/SharedCompendiums.zip
I then used this script to move the paths stored in Foundry for thopse image assets to thier new location.
This will likley NOT work for anyone that has not properly organizaed thier files... for me I placed similar files in a sub directory structure that mapped micely.
This acts like a SEARCH and REPLACE function in word... tell the script what part of the path to search for and what to replace it with.
Click and wait!
I then moved all of my content into the shared compendium module and I could create my new world and remove the old world. :)
HUGE shout out to FREEZE on Discord macro-polo FoundryVTT channel for all of their help as I wrote my first code in a decade.
I am open to feedback and code corrections, I long ago got the lobotamy and moved into management, my first programming job was 68030 assembly and my last was in Java when it first came out. So please be polite :)
Thank you everyone for all of your support.