Hello,
I tested your tool on latest published version (24.08.29) but when I execute with the following arguments:
.\Hyper-V-Backup.ps1 -BackupTo D:\HV_VM_BKPs\ -NoPerms -Keep 30 -Compress -L D:\scripts\logs\ -LogRotate 30
* BackupTo
* -NoPerms
* - Keep 30 (last 30 days backups)
* - Compress
* - L
* - LogRotate 30 (last 30 days logs)
then previous backups older than 30 days, are not being successfully removed.
I think it could be happening when my VM is called SRV_DOMOTICS and then the function that this part of the code (line 637) has some issue due to the RemoveFilePat string defined there. Do you thing this is something you could improve. When a VM has underscore character on it?
## Remove previous backup files older than X days. -Keep and -Compress switch are configured.
else {
Write-Log -Type Info -Evt "(VM:$Vm) Removing compressed backups older than: $History days"
## Remove previous compressed backups older than the configured number of days.
If ($ShortDate)
{
ReportRemove -RemoveDir $WorkDir -RemoveFilePat "-*-*-*.*" -RemoveDirOpt $false -RemoveHistory $History
}
else {
ReportRemove -RemoveDir $WorkDir -RemoveFilePat "-*-*-*_*-*-*.*" -RemoveDirOpt $false -RemoveHistory $History
}
Thanks,
Hello,
I tested your tool on latest published version (24.08.29) but when I execute with the following arguments:
.\Hyper-V-Backup.ps1 -BackupTo D:\HV_VM_BKPs\ -NoPerms -Keep 30 -Compress -L D:\scripts\logs\ -LogRotate 30
then previous backups older than 30 days, are not being successfully removed.
I think it could be happening when my VM is called SRV_DOMOTICS and then the function that this part of the code (line 637) has some issue due to the RemoveFilePat string defined there. Do you thing this is something you could improve. When a VM has underscore character on it?
Thanks,