If I have a path
C:\folder1\folder2\folder3\keyfolder\folder4\file.ext and a string keyfolder which corresponds to one of the subfolders in the path, how can I change the path root up until the keyfolder string to have a result such as C:\newfolder1\newfolder2\keyfolder\folder4\file.ext? Basically what I am trying to do is change the folder structure of a file up until a keyfolder folder.
SET OLD=C:\folder1\folder2\folder3\keyfolder\folder4\file.ext
SET KEY=keyfolder
SET NEW=C:\newfolder1\newfolder2
Now I just need to replace OLD with NEW up until KEY.
Thank you!
Andrew