I make an overnight backup of all files modified on the last day using PowerShell.
The goal is to create an uncompressed zip (or any other format) that will group everything into a backup folder into a single file using PowerShell.
The following code is great for compression, but it's too slow:
function Add-Zip
{
param([string]$zipfilename)
if(-not (test-path($zipfilename)))
{
set-content $zipfilename ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
(dir $zipfilename).IsReadOnly = $false
}
$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($zipfilename)
foreach($file in $input)
{
$zipPackage.CopyHere($file.FullName)
Start-sleep -milliseconds 1000
}
}
Any ideas?
Thank!
source
share