Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

PowerShell – Create Zip File

Posted on January 12, 2017 By David Kittell

Scenario, you’re on a Windows Server and don’t want to or can’t install a zip program.

This script will help you create a zip file without any special program.

Caveat: Currently this does not give you any kind of status so it could seem to be doing nothing for a while depending on the size of the directory you want/need to compress.

function ZipFiles( $zipfilename, $sourcedir )
{
   Add-Type -Assembly System.IO.Compression.FileSystem
   $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
   [System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir,
        $zipfilename, $compressionLevel, $false)
}

ZipFiles c:\Drivers.zip D:\
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code PowerShell

Post navigation

Previous post
Next post

Related Posts

Azure Red Hat – RHUI Update

Posted on December 27, 2016January 9, 2017

Most of the this script is based on the document “Red Hat Update Infrastructure (RHUI) for on-demand Red Hat Enterprise Linux VMs in Azure” at https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-linux-update-infrastructure-redhat?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json My change will first check if the update was already installed, if not it will follow the process to install See updates at: https://gitlab.com/Kittell-RedHat/AzureRepo/raw/master/AzureRedHatRepoUpdate.sh…

Read More

UNIX – SED Replace Tab with Space(s)

Posted on December 20, 2017

sed ‘s/\t/ /g’ tab-file.txt > no-tab-file.txt Originally found at https://linuxconfig.org/replace-all-tab-characters-with-spaces All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just…

Read More

MSSQL Get Domain From Email Address

Posted on October 19, 2018

SELECT DISTINCT RIGHT(Email, LEN(Email) – CHARINDEX(‘@’, email)) Domain FROM contacts SELECT RIGHT(Email, LEN(Email) – CHARINDEX(‘@’, email)) Domain, COUNT(Email) EmailCount FROM contacts WHERE LEN(Email) > 0 GROUP BY RIGHT(Email, LEN(Email) – CHARINDEX(‘@’, email)) ORDER BY EmailCount DESC, Domain Reference: https://blog.sqlauthority.com/2011/06/18/sql-server-selecting-domain-from-email-address/ All information on this site is shared with the intention to…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes