updateseq: only create the _collisions folder if collisions are found.

This commit is contained in:
Nathan
2026-02-06 16:49:20 -07:00
parent f03fba1671
commit f9419a6649
2 changed files with 771 additions and 13 deletions
+7 -2
View File
@@ -166,10 +166,15 @@ function Rename-SequencePreviewMp4 {
} | Sort-Object -Property @{ Expression = { -not $_.FrameMatch }; Ascending = $true }, @{ Expression = 'LastWrite'; Descending = $true })
$best = $candidates[0].File
$moveToCollisions = if ($candidates.Count -gt 1) { $candidates[1..($candidates.Count - 1)] } else { @() }
$moveToCollisions = @(if ($candidates.Count -gt 1) { $candidates[1..($candidates.Count - 1)] } else { @() })
$hasCollisions = ($moveToCollisions.Count -gt 0) -or ($best.Name -ne $targetName -and (Test-Path -LiteralPath $targetPath))
if (-not $hasCollisions -and $best.Name -eq $targetName) {
return [pscustomobject]@{ Renamed = 0; Collisions = 0; Errors = 0; Checked = $checked }
}
try {
if (-not (Test-Path -LiteralPath $collisionsDir)) {
if ($hasCollisions -and -not (Test-Path -LiteralPath $collisionsDir)) {
New-Item -ItemType Directory -Path $collisionsDir -Force | Out-Null
}