# How to replace an orphaned external file by an existing one? (all instances)

I used a video file in the VSE which is cut into many parts. When the project grew, I needed to reorganize the linked files. I renamed this video file. Now Blender doesn't see this file anymore.

In Motion5, there is a function "Replace Media" that lets you replace external files used in many strips by new ones for the whole project.

Does something similar exist in Blender by default or does anybody know a script that can do this?

• Have you tried File->External Data->Find Missing Files? It should work on vse files. Oct 22 '15 at 14:17
• "Find Missing Files" function searches for files with the original file name. I need to replace the original file by file with different name. If it would be only one strip I can change only path to the file with changed name, but there are many strips using the same source file. Oct 22 '15 at 15:22

You can set the filepath attribute on your sequences with python:

import bpy
for seq in bpy.data.scenes['Scene'].sequence_editor.sequences_all:
if 'image_a' in seq.elements[0].filename:
seq.elements[0].filename = "image_b.png"


You can optionally change the files location setting seq.directory if needed.

• Script fails in both cases, can you be more descriptive? Thank you for help. blend: dl.dropboxusercontent.com/u/55113627/%3E%20Blender/… screen: dl.dropboxusercontent.com/u/55113627/%3E%20Blender/… Nov 21 '15 at 1:39
• Well, that's much better - providing a "test" file with your problem always helps so much more - great job! I updated the answer, it's working now with your blend file. Btw: you can use blend-exchange.giantcowfilms.com to upload a blend-file and use the insert image function here on stackexchange. Would be good if you'd update your question with your image - as good images always help for a better understanding of what you want to achieve. Nov 21 '15 at 9:22
• Yeah, thank you very much :) now it works. Would be great to have a button for that :) But I will definitely save your script. And sorry if it wasn't enough clear from question. BTW what is zero in your script? Nov 22 '15 at 0:02
• You mean the indices [0]? That's the first (zero based) element in a list of many. A sequence may consist of more than one file (e.g. a image sequence) with different names, but in your case as you use a video source only one file is used per sequence, so only this single one has to be altered. Nov 22 '15 at 0:23