I've just started using Powershell and I want to create z zip archive then move a file to it
Creating the zip works fine but I am having no joy moving the file to it
I'm using:
$zipfilename = 'c:\cwRsync\backup.zip'
$file = 'c:\cwRsync\backup.log'
set-content $zipfilename ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
(dir $zipfilename).IsReadOnly = $false
$zipfile = (New-Object -ComObject shell.application).NameSpace($zipfilename)
$zipfile.MoveHere($file)
No errors but it doesn't work :(
Any help would be much appreciated
I did manage to use Copy-ToZip to add a file and I could use that then delete the file but I would really like to know what is wrong with my script
Any help would be much appreciated