Using Python to retarget animations to a folder

I want to create a script to create a number of retargeted animations from one folder to a different folder. I am following the instructions on this web page, but the script provided doesn’t allow you to set the target folder


# Use the asset subsystem to get asset data.
asset_subsystem = unreal.get_editor_subsystem(unreal.EditorAssetSubsystem)
# Get a list of asset data, which you can use for Anim Sequences, Anim Blueprints, Pose Assets, and more.
assets_to_retarget = [
asset_subsystem.find_asset_data(“/Game/Characters/Mannequins/Animations/Manny/MM_Fall_Loop”),
asset_subsystem.find_asset_data(“/Game/Characters/Mannequins/Animations/Manny/MM_Idle”)]
retarget_asset = unreal.load_asset(name = ‘/Game/Characters/Mannequins/Rigs/RTG_Mannequin’)
source_mesh = None # will use mesh from source ik rig
target_mesh = None # will use mesh from target ik rig
batch_op = unreal.IKRetargetBatchOperation.duplicate_and_retarget(
assets_to_retarget,
source_mesh,
target_mesh,
retarget_asset,
search = “”,
replace = “”,
prefix = “”,
suffix = “”,
remap_referenced_assets = True)

I tried to use the other version here: unreal.IKRetargetBatchOperation — Unreal Python 5.8 (Experimental) documentation to set the target_path, but it gives me an error

LogPython: Error: batch_op = unreal.IKRetargetBatchOperation.duplicate_and_retarget(
LogPython: Error: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LogPython: Error: TypeError: duplicate_and_retarget() ‘target_path’ is an invalid keyword argument for this function

Not sure what I am doing wrong.