updateseq: only create the _collisions folder if collisions are found.
This commit is contained in:
+7
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user