-
-
Notifications
You must be signed in to change notification settings - Fork 40
Previous backups from N days are not being deleted successfully when VM name contains an underscore character on the VM name #41
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working