OK, for those of us who have experience in the *NIX world, the lack of native abilities or tool sets that should just be... "duh", included in an OS is a continual source of aggravation when working in a "Windows" world.
Let's leave behind difference between "dir" and "ls", or the ability to manipulate files and streams directly from the "command line" without having to open a different "shell". *and yes, of course, some *NIX aficionados would argue, "Well, I don't like bash, so i open a ksh anyway" would be valid arguments to the Windows proponents of "PowerShell".
To not be able to "grep" and pipe to another command, without then invoking a GUI operation, or to have to spend massive amounts of time investigating which switches, options, and syntactic anomalies are, or are not allowed can also be seen as forgivable or explained away as "differences" and "limitations" of one or both platforms.
But, what is not excusable is the "limitation" that Windows has built into the OS with regard to "compression". Their first attempt is a built in function/method and can be invoked fairly easily, but was never as economical as PKZip, or other 3rd party "zip" compression methods. These are easily invoked on the *NIX command line, either having been integrated via:
[user@localhost ~]# tar -czvf archive.tgz *.txt; rm -f *.txt
Or something along those lines; I haven't touched my Linux system in ages, and I just ran that to archive my "home" folder within minutes.
Now, think about how powerful that can be on a production server!
Being able to quickly and easily (either manually at the command prompt, or schedule as a maintenance activity via a *.sh script fired off by your crontab) manage your server's file system is a basic duty of server administration.
Well, I have spent this entire morning, attempting to do the very same thing on one of my Windows Server 2008 machines.
Rather than continue a rant about the difficulty involved, here it is:
Mike Hodnick has contributed to the PowerShell community a nifty *.ps1 script that does exactly what you would expect - a quick and easy way to "zip" up a directory.
http://blogs.inetium.com/blogs/mhodnick/archive/2006/08/07/295.aspx
I will post the code at the bottom in case this link ever drifts into the ether...
The difficulty was that with VBS code, I could not get consistent results whether using a 3rd party Zip tool, or via Windows scripted methods.
This PowerShell script however, does exactly what it should.
Here is the code:
all propr and rights to Mike Hodnick
########################################################
#
# out-zip.ps1
#
# Usage:
#
# To zip up some files:
# ls c:\source\*.txt | out-zip c:\target\archive.zip $_
#
# To zip up a folder:
# gi c:\source | out-zip c:\target\archive.zip $_
########################################################
$path = $args[0]
$files = $input
if (-not $path.EndsWith('.zip')) {$path += '.zip'}
if (-not (test-path $path)) {
set-content $path ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
}
$ZipFile = (new-object -com shell.application).NameSpace($path)
$files | foreach {$zipfile.CopyHere($_.fullname)}