$path = "C:\Users\eps\Desktop\Archive" $source = Get-ChildItem -Path C:\Users\eps\Desktop\Archive Add-Type -assembly "system.io.compression.filesystem" Foreach ($s in $source) { $destination = Join-path -path $path -ChildPath "$($s.name).zip" If(Test-path $destination) {Remove-Item $path} [io.compression.zipfile]::CreateFromDirectory($s.fullname, $destination)}
$path
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)