If you don't have many Wavefront materials and you are copying all images from the same location to another location (also same for all pictures), open the .mtl file and replace all texture paths manually. You can try to speed this process up by using well-placed replace commands.
Otherwise, you'll need to write a script that reads all the path and edits them manually.
- Read the file line-wise
- Split each line by space. The first sub string will be the command
- on "map_kd" and other map commands, read the rest of the string a path.
- Edit the path. In Java you move a path
path
from path from
to path to
with the following code: to.resolve(from.toAbsolutePath().relativize(path));
- Overwrite the line
You can also import the file as is if the program you used for importing supports moving source files.
And don't forget:
Always back up your files!