Jul 2, 2026, 9:43 AM
This commit is contained in:
@@ -102,13 +102,17 @@ foreach ($folder in $FoldersToProcess) {
|
||||
$S3Destination = "$S3DestinationParent/$CurrentYear"
|
||||
|
||||
Write-Host "`n[$(Get-Date -Format 'HH:mm:ss')] Przetwarzanie: $folder ..." -ForegroundColor Yellow
|
||||
Write-Host " Sprawdzanie i przygotowywanie docelowego folderu na S3: $S3DestinationParent/$CurrentYear/" -ForegroundColor Gray
|
||||
Write-Host " Sprawdzanie struktury docelowej na S3: $S3DestinationParent/" -ForegroundColor Gray
|
||||
|
||||
# 1. Tworzenie folderu na S3 (rclone mkdir upewni się, że struktura istnieje)
|
||||
# Tłumimy ostrzeżenie (2>$null), ponieważ S3 to "object storage" i ostrzega, że nie obsługuje pustych folderów.
|
||||
& $RcloneExePath mkdir "$S3Destination" 2>$null
|
||||
# Sprawdzamy czy folder roczny istnieje, wyłącznie w celach informacyjnych.
|
||||
# W S3 foldery tworzą się same automatycznie w momencie wgrania pierwszego pliku.
|
||||
$s3Dirs = & $RcloneExePath lsf --dirs-only "$S3DestinationParent/" 2>$null
|
||||
if ($s3Dirs -contains "$CurrentYear/") {
|
||||
Write-Host " Folder '$CurrentYear/' istnieje na S3. Aktualizowanie danych..." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " Folder '$CurrentYear/' nie istnieje na S3. Zostanie utworzony automatycznie podczas pierwszego transferu." -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
Write-Host " Folder gotowy. Rozpoczynam transfer danych..." -ForegroundColor Green
|
||||
$LogFile = Join-Path $LogDir "rclone_backup_$($folder)_$(Get-Date -Format 'yyyyMMdd_HHmmss').log"
|
||||
|
||||
# 2, 3, 4. Pokazywanie progresu, wypisywanie plików i logowanie
|
||||
|
||||
Reference in New Issue
Block a user