Merge branch 'main' of http://192.168.86.64:3000/Raincloud/ProjectStructure_HOME
This commit is contained in:
@@ -17,8 +17,11 @@ function Get-YoungestTimestamp {
|
||||
return $young
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
=======
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
function Sync-SequenceFilenames {
|
||||
param(
|
||||
[Parameter(Mandatory)] [string]$SequenceFolderPath,
|
||||
@@ -83,7 +86,10 @@ function Sync-SequenceFilenames {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> main
|
||||
=======
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
try {
|
||||
$root = (Get-Location).ProviderPath
|
||||
$currentDir = Join-Path $root '_CURRENT'
|
||||
@@ -91,8 +97,12 @@ try {
|
||||
New-Item -ItemType Directory -Path $currentDir -Force | Out-Null
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$logFile = Join-Path $currentDir '_UpdateSequences.log'
|
||||
=======
|
||||
$logFile = Join-Path $currentDir '_UpdateSequences.log'
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
|
||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] === UpdateSequences (ps1) started in '$root' ===" | Add-Content -LiteralPath $logFile
|
||||
|
||||
@@ -101,6 +111,7 @@ try {
|
||||
|
||||
$mapDaily = @{}
|
||||
$dailiesScanned = 0
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
$logFile = Join-Path $currentDir '_UpdateSequences.log'
|
||||
|
||||
@@ -114,6 +125,11 @@ try {
|
||||
$renameCollisions = 0
|
||||
$renameErrors = 0
|
||||
>>>>>>> main
|
||||
=======
|
||||
$filesRenamedTotal = 0
|
||||
$renameCollisions = 0
|
||||
$renameErrors = 0
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
foreach ($d in $dailyDirs) {
|
||||
$dailiesScanned++
|
||||
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory | Where-Object { $_.Name -ne '_archive' })
|
||||
@@ -121,7 +137,10 @@ try {
|
||||
foreach ($s in $seqDirs) {
|
||||
if (-not (Test-Path -LiteralPath $s.FullName)) { continue }
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
=======
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
$renameResult = Sync-SequenceFilenames -SequenceFolderPath $s.FullName -SequenceName $s.Name -LogFile $logFile
|
||||
if ($DebugMode -or $renameResult.Renamed -gt 0 -or $renameResult.Collisions -gt 0 -or $renameResult.Errors -gt 0) {
|
||||
Write-Host "[RENAME]|$($s.FullName)|$($s.Name)|checked=$($renameResult.Checked)|renamed=$($renameResult.Renamed)|collisions=$($renameResult.Collisions)|errors=$($renameResult.Errors)" -ForegroundColor Cyan
|
||||
@@ -129,7 +148,10 @@ try {
|
||||
$filesRenamedTotal += $renameResult.Renamed
|
||||
$renameCollisions += $renameResult.Collisions
|
||||
$renameErrors += $renameResult.Errors
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> main
|
||||
=======
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
$young = Get-YoungestTimestamp -FolderPath $s.FullName
|
||||
$filesCount = @(Get-ChildItem -LiteralPath $s.FullName -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.FullName -notlike '*\_archive\*' }).Count
|
||||
$seqName = $s.Name
|
||||
@@ -169,6 +191,7 @@ try {
|
||||
$lines += "[SKIP]|$($d.SrcFull)|$($d.Seq)|reason=notNewer|srcYoung=$($d.Young.ToString('s'))|curYoung=$($curYoung.ToString('s'))"
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$lines += "[META]|dailiesScanned=$dailiesScanned|sequencesTotal=$total|toCopy=$toCopy"
|
||||
|
||||
@@ -187,6 +210,10 @@ try {
|
||||
=======
|
||||
$lines += "[META]|dailiesScanned=$dailiesScanned|sequencesTotal=$total|toCopy=$toCopy"
|
||||
|
||||
=======
|
||||
$lines += "[META]|dailiesScanned=$dailiesScanned|sequencesTotal=$total|toCopy=$toCopy"
|
||||
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
# Print plan to console instead of writing to file
|
||||
Write-Host "=== UPDATE PLAN ===" -ForegroundColor Cyan
|
||||
foreach ($line in $lines) {
|
||||
@@ -199,7 +226,10 @@ try {
|
||||
}
|
||||
}
|
||||
Write-Host "==================" -ForegroundColor Cyan
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> main
|
||||
=======
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
|
||||
$sequencesMirrored = 0
|
||||
$mirrorFailures = 0
|
||||
@@ -212,6 +242,7 @@ try {
|
||||
<<<<<<< HEAD
|
||||
if (-not (Test-Path -LiteralPath $dstAbs)) { New-Item -ItemType Directory -Path $dstAbs -Force | Out-Null }
|
||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] Mirror: '$srcFull' -> '$dstAbs'" | Add-Content -LiteralPath $logFile
|
||||
<<<<<<< HEAD
|
||||
$args = @(
|
||||
=======
|
||||
if (Test-Path -LiteralPath $dstAbs) {
|
||||
@@ -227,15 +258,22 @@ try {
|
||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] Mirror: '$srcFull' -> '$dstAbs'" | Add-Content -LiteralPath $logFile
|
||||
$robocopyArgs = @(
|
||||
>>>>>>> main
|
||||
=======
|
||||
$robocopyArgs = @(
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
$srcFull,
|
||||
$dstAbs,
|
||||
'/MIR','/MT:8','/R:1','/W:1','/COPY:DAT','/DCOPY:DAT','/FFT','/NFL','/NDL','/NP','/NJH','/NJS','/XD','_archive'
|
||||
)
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$null = & robocopy @args 2>&1 | Add-Content -LiteralPath $logFile
|
||||
=======
|
||||
$null = & robocopy @robocopyArgs 2>&1 | Add-Content -LiteralPath $logFile
|
||||
>>>>>>> main
|
||||
=======
|
||||
$null = & robocopy @robocopyArgs 2>&1 | Add-Content -LiteralPath $logFile
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
$rc = $LASTEXITCODE
|
||||
if ($rc -lt 8) {
|
||||
$sequencesMirrored++
|
||||
@@ -247,6 +285,7 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
# Print summary report to console
|
||||
Write-Host "=== SUMMARY REPORT ===" -ForegroundColor Magenta
|
||||
@@ -255,40 +294,51 @@ try {
|
||||
Write-Host "Planned copies: $toCopy" -ForegroundColor Green
|
||||
Write-Host "Completed OK: $sequencesMirrored" -ForegroundColor Green
|
||||
Write-Host "Completed FAIL: $mirrorFailures" -ForegroundColor Red
|
||||
=======
|
||||
# Print summary report to console
|
||||
Write-Host "=== SUMMARY REPORT ===" -ForegroundColor Magenta
|
||||
Write-Host "Dailies scanned: $dailiesScanned" -ForegroundColor White
|
||||
Write-Host "Sequences found: $total" -ForegroundColor White
|
||||
Write-Host "Planned copies: $toCopy" -ForegroundColor Green
|
||||
Write-Host "Completed OK: $sequencesMirrored" -ForegroundColor Green
|
||||
Write-Host "Completed FAIL: $mirrorFailures" -ForegroundColor Red
|
||||
Write-Host "Files renamed: $filesRenamedTotal (collisions: $renameCollisions, errors: $renameErrors)" -ForegroundColor White
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
|
||||
# Summarize skipped sequences
|
||||
$skippedLines = @()
|
||||
foreach ($line in $lines) {
|
||||
if ($line.StartsWith('[SKIP]')) {
|
||||
$skippedLines += $line
|
||||
}
|
||||
}
|
||||
if ($skippedLines.Count -gt 0) {
|
||||
Write-Host "`n=== SKIPPED SEQUENCES ===" -ForegroundColor Yellow
|
||||
$skippedByReason = @{}
|
||||
foreach ($skip in $skippedLines) {
|
||||
$parts = $skip -split '\|'
|
||||
$reason = $parts[3]
|
||||
$seqName = $parts[2]
|
||||
if (-not $skippedByReason.ContainsKey($reason)) {
|
||||
$skippedByReason[$reason] = @()
|
||||
}
|
||||
$skippedByReason[$reason] += $seqName
|
||||
}
|
||||
# Summarize skipped sequences
|
||||
$skippedLines = @()
|
||||
foreach ($line in $lines) {
|
||||
if ($line.StartsWith('[SKIP]')) {
|
||||
$skippedLines += $line
|
||||
}
|
||||
}
|
||||
if ($skippedLines.Count -gt 0) {
|
||||
Write-Host "`n=== SKIPPED SEQUENCES ===" -ForegroundColor Yellow
|
||||
$skippedByReason = @{}
|
||||
foreach ($skip in $skippedLines) {
|
||||
$parts = $skip -split '\|'
|
||||
$reason = $parts[3]
|
||||
$seqName = $parts[2]
|
||||
if (-not $skippedByReason.ContainsKey($reason)) {
|
||||
$skippedByReason[$reason] = @()
|
||||
}
|
||||
$skippedByReason[$reason] += $seqName
|
||||
}
|
||||
|
||||
foreach ($reason in $skippedByReason.Keys) {
|
||||
$seqs = $skippedByReason[$reason]
|
||||
Write-Host "$reason ($($seqs.Count) sequences):" -ForegroundColor Yellow
|
||||
foreach ($seq in $seqs | Sort-Object) {
|
||||
Write-Host " - $seq" -ForegroundColor White
|
||||
}
|
||||
}
|
||||
Write-Host "========================" -ForegroundColor Yellow
|
||||
}
|
||||
Write-Host "=====================" -ForegroundColor Magenta
|
||||
foreach ($reason in $skippedByReason.Keys) {
|
||||
$seqs = $skippedByReason[$reason]
|
||||
Write-Host "$reason ($($seqs.Count) sequences):" -ForegroundColor Yellow
|
||||
foreach ($seq in $seqs | Sort-Object) {
|
||||
Write-Host " - $seq" -ForegroundColor White
|
||||
}
|
||||
}
|
||||
Write-Host "========================" -ForegroundColor Yellow
|
||||
}
|
||||
Write-Host "=====================" -ForegroundColor Magenta
|
||||
|
||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] === UpdateSequences (ps1) completed (d=$dailiesScanned seq=$total ok=$sequencesMirrored fail=$mirrorFailures) ===" | Add-Content -LiteralPath $logFile
|
||||
|
||||
<<<<<<< HEAD
|
||||
Write-Host "@$logFile"
|
||||
=======
|
||||
# Print summary report to console
|
||||
@@ -335,6 +385,9 @@ try {
|
||||
|
||||
Write-Host "@$logFile"
|
||||
>>>>>>> main
|
||||
=======
|
||||
Write-Host "@$logFile"
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
exit 0
|
||||
}
|
||||
catch {
|
||||
@@ -349,7 +402,12 @@ catch {
|
||||
exit 1
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
|
||||
>>>>>>> main
|
||||
=======
|
||||
|
||||
|
||||
>>>>>>> d89d8e0cf215637d0ffabf165877815ab4203f37
|
||||
|
||||
Reference in New Issue
Block a user