Jul 2, 2026, 9:39 AM
This commit is contained in:
@@ -102,29 +102,26 @@ foreach ($folder in $FoldersToProcess) {
|
|||||||
$S3Destination = "$S3DestinationParent/$CurrentYear"
|
$S3Destination = "$S3DestinationParent/$CurrentYear"
|
||||||
|
|
||||||
Write-Host "`n[$(Get-Date -Format 'HH:mm:ss')] Przetwarzanie: $folder ..." -ForegroundColor Yellow
|
Write-Host "`n[$(Get-Date -Format 'HH:mm:ss')] Przetwarzanie: $folder ..." -ForegroundColor Yellow
|
||||||
Write-Host " Sprawdzanie istnienia docelowego folderu na S3: $S3DestinationParent/$CurrentYear/" -ForegroundColor Gray
|
Write-Host " Sprawdzanie i przygotowywanie docelowego folderu na S3: $S3DestinationParent/$CurrentYear/" -ForegroundColor Gray
|
||||||
|
|
||||||
# Walidacja obecności folderu (roku) po stronie S3 za pomocą rclone lsf (wypisuje tylko foldery)
|
# 1. Tworzenie folderu na S3 (rclone mkdir upewni się, że struktura istnieje)
|
||||||
$s3Dirs = & $RcloneExePath lsf --dirs-only "$S3DestinationParent/" 2>$null
|
& $RcloneExePath mkdir "$S3Destination"
|
||||||
if ($s3Dirs -notcontains "$CurrentYear/") {
|
|
||||||
$errMsg = "Brak wymaganego folderu '$CurrentYear/' w lokalizacji '$S3DestinationParent/' na S3. Pomijam transfer."
|
|
||||||
Write-Host " Błąd: $errMsg" -ForegroundColor Red
|
|
||||||
Write-AppEventLog -Type Warning -Id 1002 -Message $errMsg
|
|
||||||
$GlobalExitCode = 1
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host " Folder '$CurrentYear/' znaleziony. Rozpoczynam transfer danych..." -ForegroundColor Green
|
Write-Host " Folder gotowy. Rozpoczynam transfer danych..." -ForegroundColor Green
|
||||||
$LogFile = Join-Path $LogDir "rclone_backup_$($folder)_$(Get-Date -Format 'yyyyMMdd_HHmmss').log"
|
$LogFile = Join-Path $LogDir "rclone_backup_$($folder)_$(Get-Date -Format 'yyyyMMdd_HHmmss').log"
|
||||||
|
|
||||||
|
# 2, 3, 4. Pokazywanie progresu, wypisywanie plików i logowanie
|
||||||
|
# --progress (-P) - pokazuje interaktywny pasek postępu i prędkość
|
||||||
|
# --verbose (-v) - wypisuje nazwy przenoszonych plików
|
||||||
$RcloneArgs = @(
|
$RcloneArgs = @(
|
||||||
"move", $SourceDir, $S3Destination,
|
"move", $SourceDir, $S3Destination,
|
||||||
"--checksum",
|
"--checksum",
|
||||||
"--retries", "5",
|
"--retries", "5",
|
||||||
"--retries-sleep", "15s",
|
"--retries-sleep", "15s",
|
||||||
"--delete-empty-src-dirs",
|
"--delete-empty-src-dirs",
|
||||||
"--log-file=$LogFile",
|
"--progress",
|
||||||
"--log-level=INFO"
|
"--verbose",
|
||||||
|
"--log-file=$LogFile"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Uruchomienie rclone
|
# Uruchomienie rclone
|
||||||
|
|||||||
Reference in New Issue
Block a user