copiere backup
This commit is contained in:
@@ -44,10 +44,8 @@ function Test-SSHConnection {
|
||||
}
|
||||
|
||||
function Get-TodaysBackups {
|
||||
Write-Log "Searching for today's backup files..."
|
||||
Write-Log "Searching for backup files..."
|
||||
|
||||
$today = Get-Date
|
||||
$cutoffDate = $today.Date # Only today (after midnight)
|
||||
$backupFiles = @()
|
||||
|
||||
$searchPaths = @(
|
||||
@@ -57,10 +55,9 @@ function Get-TodaysBackups {
|
||||
|
||||
foreach ($path in $searchPaths) {
|
||||
if (Test-Path $path) {
|
||||
# Get files created TODAY only (exclude old backups)
|
||||
# Get ALL backup files (duplicates will be skipped during transfer)
|
||||
$files = Get-ChildItem -Path $path -Recurse -File -ErrorAction SilentlyContinue |
|
||||
Where-Object {
|
||||
$_.LastWriteTime -gt $cutoffDate -and
|
||||
$_.Name -notlike "*__TAG_*" # Exclude old uncompressed backups
|
||||
} |
|
||||
Sort-Object LastWriteTime -Descending
|
||||
@@ -70,7 +67,7 @@ function Get-TodaysBackups {
|
||||
}
|
||||
|
||||
if ($backupFiles.Count -eq 0) {
|
||||
Write-Log "No backup files found for today!" "WARNING"
|
||||
Write-Log "No backup files found!" "WARNING"
|
||||
return @()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user