Move files to a zip file
New-zip | Get-zip | Extract-Zip | Move-Zip | Copy-Zip |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
############################################################ # # NAME : Move-ZIP # # AUTHOR : Wessel van Sandwijk # # Website : http://www.useful-it.nl # # COMMENT : Move ZipFile # # VERSION HISTORY : # 1.0 07-MRT-2013 - Initial Version # ############################################################ dir c:\demo\files\*.* -Recurse | Move-Zip c:\demo\myzip.zip ############################################################ # # FUNCTIONS # ############################################################ function Move-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.MoveHere($file.FullName) Start-sleep -milliseconds 500 } } |
wvsandwijk
I am a Technical Specialist - Cloud Infrastructures from the Netherlands.
My Skills are mainly PowerShell, VMWare, Hyper-V, Microsoft System Center products and Windows Azure Pack.
I work for a company in Utrecht The Netherlands.
My Skills are mainly PowerShell, VMWare, Hyper-V, Microsoft System Center products and Windows Azure Pack.
I work for a company in Utrecht The Netherlands.
Latest posts by wvsandwijk (see all)
- [PS] VMware ESX Certificate validation - September 7, 2018
- PoSH-Git : unable to start ssh-agent service, error :1058 - July 22, 2018
- [PS] Speedup VMWare PowerShell module - June 11, 2018