# Recursively search and replace through *.json workflows # Preserves original Created and Modified timestamps # Targets specific "video\ paths starting with a literal double quote # --- Configuration --- $rootPath = "C:\Data\ComfyUser\default\workflows\" $preserveTimestamps = $true $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" # Directory migrations " $newValue" $changed = $true } } if ($changed -and $content -ne $originalContent) { try { # Capture timestamps if ($preserveTimestamps) { $origCreated = $file.CreationTime $origModified = $file.LastWriteTime } # Move to Recycle Bin [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile( $file.FullName, [Microsoft.VisualBasic.FileIO.UIOption]::OnlyErrorDialogs, [Microsoft.VisualBasic.FileIO.RecycleOption]::SendToRecycleBin ) # Write new file Set-Content -Path $file.FullName -Value $content -Encoding UTF8 # Restore timestamps if ($preserveTimestamps) { $newFile = Get-Item -Path $file.FullName $newFile.CreationTime = $origCreated $newFile.LastWriteTime = $origModified } Write-Host "Updated: $($file.FullName)" Write-Host "" } catch { Write-Host "ERROR updating: $($file.FullName)" Write-Host " $($_.Exception.Message)" Write-Host "" } } } Write-Host "Done."