I want to compress multiple files into one zip.
I am stuck with this at the moment:
Get-ChildItem -path C:\logs -Recurse | Where {$_.Extension -eq ".csv" -and $_.LastWriteTime -lt (Get-Date).AddDays(-7)} | write-zip -level 9 -append ($_.LastWriteTime).zip | move-item -Force -Destination {
$dir = "C:\backup\archive"
$null = mkdir $dir -Force
"$dir\"
}
I get this exception
Write-Zip : Cannot bind argument to parameter 'Path' because it is null.
This part is the problem:
write-zip -level 9 -append ($_.LastWriteTime).zip
I have never used powershell before but i have to provide a script, I can't provide a c# solution.