Changing source file path on multiple ue assets

I am re-organizing directory structure on source contents(fbx files). The problem is, it breaks reference path(Source File) on ue assets. For example, an animation sequence “Idle” was in “Character/Animations/Idle” folder. Now I moved it to “Characters/Animation/Navigation/Idle”. Then when you re-import the ue asset, it can’t find the path since the source fbx file was moved to the new folder. There is an option where you can set source file path, but it is not realistic to go through thousands of ue assets and updating one by one manually.

My questions is, is there any way to batch update source file path on multiple ue assets?

Thanks,

2 Likes

I would like to know that as well…anyone?

3 Likes

Just commenting because I’d like to know this as well. As I’m working on two different computers and transferring assets between them. It would be handy to change the asset source locations on mass.

1 Like

Any updates on this? I need to do the exact same thing with hundreds of audio files.

1 Like

I posted the example code here. I change the source file path of texture assets.

1 Like

We need this too. There doesn’t seem to be a solution to this as of now.

drag in the fbx’s with the same name into the content browser. It will prompt to re import, but this time with the updated source path.

3 Likes

We had a similar challenge with updating a lot of pose assets. We created a utility widget and updated the source path for each item. You could probably make something similar and just feed in your new source path. ( credit: this widget created by Ray Arnett)

1 Like

Sorry to necro this topic but rather than yet another “I have this problem too” reply, I think I have an actual solution. Create an editor utility blueprint, of the style Asset Action Utility. Then paste the code into it from here : Change source paths of selected assets (a blueprint editor utility script) posted by englishdutchman | blueprintUE | PasteBin For Unreal Engine Note that you’ll need to create two string variables in the main function. Compile it then select a bunch of assets and in the right-click menu you should find (in scripted actions) a new action called [CL] universal path remapper. Select it, enter the part of the path you want to change from and to and it ought to remap all those source paths. For example ‘from’ might be ‘/project1/car/’ and ‘to’ might be ‘/project2/carB/’. Experiment with caution - I’ve used this on about 2000 files in my own project and not seen any weird side effects - mostly TIF texture and FBX mesh imports.

6 Likes

I think the latest version of the code has a completely different function.

You need to scroll down the page and find an older version for changing file paths.

Hey, if anyone else is having this problem with moving large amounts of source files from one location to a different location.

I created a Python script that should fix this issue. Save this script in a safe place and then run it in Unreal Engine under “Tools > Execute Python Script…”

Note: Only change the values SOURCE_SEARCH_DIR and TARGET_BASE_DIR according to your needs.

SOURCE_SEARCH_DIR is the location of your current source files, the old location
TARGET_BASE_DIR is the new location for your source files, where you want them to be.

Code:

"""
Copyright (c) 2026 avdain. All rights reserved.
Description: Batch moves source files from a messy directory to a new drive 
and updates Unreal Engine asset references via Import Tasks.
"""

import unreal
import os
import shutil

# SOURCE_SEARCH_DIR is the location of your current source files, the old location
# TARGET_BASE_DIR is the new location for your source files, where you want them to be.

— CONFIGURATION —

SOURCE_SEARCH_DIR = r"C:\the\old\location"
TARGET_BASE_DIR = r"C:\the\new\location"

PROJECT_CONTENT_ROOT = “/Game”

---------------------

def move_and_reimport_via_task():

1. Get the Asset Tools (The engine’s main importer)

asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
asset_registry = unreal.AssetRegistryHelpers.get_asset_registry()

unreal.log("Scanning project content...")
asset_registry.scan_paths_synchronous([PROJECT_CONTENT_ROOT], True)

all_assets = asset_registry.get_assets_by_path(PROJECT_CONTENT_ROOT, recursive=True)
moved_count = 0
search_dir_norm = os.path.normpath(SOURCE_SEARCH_DIR).lower()

with unreal.ScopedSlowTask(len(all_assets), "Moving and Importing...") as slow_task:
    slow_task.make_dialog(True)
    
    for asset_data in all_assets:
        if slow_task.should_cancel():
            break
        
        asset = asset_data.get_asset()
        if not asset:
            continue
        
        # Check if this asset has import data
        import_data = None
        try:
            import_data = asset.get_editor_property('asset_import_data')
        except Exception:
            continue

        if not import_data:
            continue

        source_filenames = import_data.extract_filenames()
        
        # We only process the first source file for simplicity in this batch
        if not source_filenames:
            continue
            
        old_path = source_filenames[0]
        old_path_norm = os.path.normpath(old_path)
        
        # Check if the file is in the Downloads folder
        if old_path_norm.lower().startswith(search_dir_norm):
            
            # 1. Calculate New Path
            rel_path = os.path.relpath(old_path_norm, SOURCE_SEARCH_DIR)
            new_full_path = os.path.join(TARGET_BASE_DIR, rel_path)
            
            os.makedirs(os.path.dirname(new_full_path), exist_ok=True)

            # 2. Physical Move
            file_was_moved = False
            if os.path.exists(old_path_norm):
                try:
                    shutil.move(old_path_norm, new_full_path)
                    unreal.log(f"Moved on Disk: {old_path_norm} -> {new_full_path}")
                    file_was_moved = True
                except Exception as e:
                    unreal.log_error(f"Disk Move Failed: {e}")
                    continue
            elif os.path.exists(new_full_path):
                # File was already moved in a previous run
                unreal.log_warning(f"File already at target, forcing reimport: {new_full_path}")
                file_was_moved = True

            # 3. Create an Import Task to update Unreal
            if file_was_moved:
                task = unreal.AssetImportTask()
                task.filename = new_full_path
                task.destination_path = str(asset_data.package_path) # e.g. /Game/Footfalls
                task.destination_name = str(asset_data.asset_name)   # e.g. sand-walk-106366
                task.replace_existing = True  # <--- CRITICAL: Overwrites the existing asset
                task.automated = True         # <--- Suppresses popups
                task.save = True              # <--- Saves the asset after import
                
                # Execute the import
                asset_tools.import_asset_tasks([task])
                
                unreal.log(f"Reimport Task Complete: {asset_data.asset_name}")
                moved_count += 1
        
        slow_task.enter_progress_frame(1)

unreal.log(f"Batch complete. {moved_count} assets moved and reimported.")

if name == “main”:
move_and_reimport_via_task()
1 Like