79413672

Date: 2025-02-05 04:58:23
Score: 1.5
Natty:
Report link

Maybe this will be useful

<#Get list of files into $fileNames where $prefix is file name wildcard, like this "history_m1*.bak", $interval - time interval in days #>

$fileNames = $(Get-ChildItem -Path $sourceFolder -File | Where-Object {(New-Timespan $.LastWriteTime) -ge (New-Timespan -days -$interval) -and $.name -like $prefix})

<# zip $filenames with 7zip where $7zip is path to 7zip #>

&$7zip a -tzip $archiveName @($fileNames.ForEach({$_.Name}))

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Serg