I\'m trying to zip up log using DotNetZip and powershell. The files are in C:\\user\\temp\\logs When I loop through the logs in the directory and add them to the zip file,
Not tested, but I think this should work.
[System.Reflection.Assembly]::LoadFrom("c:\\\User\\bin\\Ionic.Zip.dll");
$zipfile = new-object Ionic.Zip.ZipFile("C:\user\temp\logs\TestZIP.zip");
$directory = "C:\user\temp\logs\"
set-location $directory
$children = get-childitem *.log
foreach ($o in $children)
{
$e = $zipfile.AddFile($o.Name)
}
}
$zipfile.Save()
$zipfile.Dispose()