Few weeks ago I needed to free some space form a disk on a Windows Server 20012 R2, so I wanted to compress a large number folders, each one of them contained few hundred MB of log files. It required to preserve the folder name and deleting or moving the files or directory from that volume/partition was not an option.
“It’s an easy task with PowerShell“, I thought, “I can re-use one of my functions or scripts“.
In fact, few months ago I’ve published an article on how to compress a folder, but to re-use that specific code on that environment I needed to install 7zip (which in this specific case I tried to avoid), because the cmd-let Compress-Archive was released with version 5 and the server is using PowerShell 4. So I needed to revisit my script that wasn’t ready to go and solve my problem without a little tweak. Continue reading “Compress a Folder With a little bit of help from .NET Framework”