# Recursively search and replace through *.json workflows for model names or paths that you want to change # Before updating a file, it will delete it to your recycle bin in case you want to recover it. # Root directory (modify this and the string replacements for the models) $rootPath = "C:\Data\ComfyUser\default\workflows\LTX\" $replacements = [ordered]@{ # 1.1 distilled LTX-2.3 "ltx-2.3-22b-distilled-lora-384.safetensors" = "ltx-2.3-22b-distilled-lora-384-1.1.safetensors" "ltx-2.3-22b-distilled.safetensors" = "ltx-2.3-22b-distilled-1.1.safetensors" # Transformer (dev) "LTXVideo\v2\ltx-2.3-22b-dev_transformer_only_fp8_scaled.safetensors" = "ltx-2-3-22b-dev_transformer_only_fp8_input_scaled.safetensors" "LTXVideo\\v2\\ltx-2.3-22b-dev_transformer_only_fp8_scaled.safetensors" = "ltx-2-3-22b-dev_transformer_only_fp8_input_scaled.safetensors" # LoRA (path cleanup) "LTX\LTX-2\ltx-2.3-22b-distilled-lora-384.safetensors" = "ltx-2.3-22b-distilled-lora-384.safetensors" "LTX\\LTX-2\\ltx-2.3-22b-distilled-lora-384.safetensors" = "ltx-2.3-22b-distilled-lora-384.safetensors" # Spatial upscaler (FIXED) "ltx-2.3-spatial-upscaler-x2-1.0.safetensors" = "ltx-2.3-spatial-upscaler-x2-1.1.safetensors" # Distilled transformer "LTXVideo\v2\ltx-2.3-22b-distilled_transformer_only_fp8_scaled.safetensors" = "ltx-2.3-22b-distilled_transformer_only_fp8_input_scaled_v3.safetensors" "LTXVideo\\v2\\ltx-2.3-22b-distilled_transformer_only_fp8_scaled.safetensors" = "ltx-2.3-22b-distilled_transformer_only_fp8_input_scaled_v3.safetensors" # VAE cleanup - on my system it wouldn't pick it up in vae_approx so I personally have these uncommented "vae_approx\taeltx2_3.safetensors" = "taeltx2_3.safetensors" "vae_approx\\taeltx2_3.safetensors" = "taeltx2_3.safetensors" # Gemma "gemma_3_12B_it_fpmixed.safetensors" = "gemma_3_12B_it_fp8_scaled.safetensors" # Additional VAE replacements "LTX23_audio_vae_bf16_KJ.safetensors" = "LTX23_audio_vae_bf16.safetensors" "LTX23_video_vae_bf16_KJ.safetensors" = "LTX23_video_vae_bf16.safetensors" } Add-Type -AssemblyName Microsoft.VisualBasic function Get-LiteralMatchCount { param ( [string]$Text, [string]$Search ) if ([string]::IsNullOrEmpty($Search)) { return 0 } $count = 0 $startIndex = 0 while ($true) { $index = $Text.IndexOf($Search, $startIndex, [System.StringComparison]::Ordinal) if ($index -lt 0) { break } $count += 1 $startIndex = $index + $Search.Length } return $count } $files = Get-ChildItem -Path $rootPath -Recurse -Filter *.json -File foreach ($file in $files) { $content = Get-Content -Path $file.FullName -Raw -Encoding UTF8 $originalContent = $content $changed = $false foreach ($oldValue in $replacements.Keys) { $newValue = $replacements[$oldValue] $count = Get-LiteralMatchCount -Text $content -Search $oldValue if ($count -gt 0) { $content = $content.Replace($oldValue, $newValue) Write-Host "[$($file.Name)] Replaced $count occurrence(s):" Write-Host " OLD: $oldValue" Write-Host " NEW: $newValue" $changed = $true } } if ($changed -and $content -ne $originalContent) { try { # Send original file to Recycle Bin [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile( $file.FullName, [Microsoft.VisualBasic.FileIO.UIOption]::OnlyErrorDialogs, [Microsoft.VisualBasic.FileIO.RecycleOption]::SendToRecycleBin ) # Write updated content back to original path Set-Content -Path $file.FullName -Value $content -Encoding UTF8 Write-Host "Updated: $($file.FullName)" Write-Host "" } catch { Write-Host "ERROR updating: $($file.FullName)" Write-Host " $($_.Exception.Message)" Write-Host "" } } } Write-Host "Done."