Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm new to Powershell. I have a need that I assumed that it would be perfect for. However, I've quickly come to the point where I feel I'm in over my head. Basically, I need to create a .zip file.

I have a directory that looks like the following:

MyStuff
  Dir1
    Child1
      File1.txt
    Child2
      File1.png
    Child3
      File1.txt
  Dir2
    File1.txt
  File1.txt
  File2.txt
  File3.txt
  ...

I need to create a .zip file named bundle.zip. Bundle.zip should NOT have all of the files inside of MyStuff. Instead, I need to include MyStuff/File1.txt, MyStuff/File2.txt, MyStuff/File3.txt, and MyStuff/Dir1/* into the .zip file. I have no idea how to do this with PowerShell.

I have PowerShell v1.0 installed on my machine. I've been trying "Write-Zip" from the PowerShell Community Extensions, however, I get an error that says: "The term 'Write-Zip' is not recognized as the name of a cmdlet, function, script file, or operable program".

What am I doing wrong?

share|improve this question
1  
I'd start by suggesting that you upgrade powershell if you can, v1.0 is relatively old and I believe things have changed rather dramatically between then and now. That being said that error sounds like you just haven't loaded the extension correctly. –  Etan Reisner Jul 30 '13 at 18:48
    
As it turns out, I have version 3 installed. I've confirmed this by running $Host.version from the powershell prompt. For some reason, MS just kept it in the v1.0 direction :/ –  user26712 Jul 30 '13 at 19:27
    
How did you install/load the extension you are trying to use? Does Get-Command Write-Zip find the command? What about Get-Module <the extension module>? –  Etan Reisner Jul 30 '13 at 19:51
    
Get-Command Write-Zip and Get-Module pscx both work from the command line just fine. –  user26712 Jul 30 '13 at 20:28
    
So in a single powershell session you can run Get-Command Write-Zip and it finds the function but if you then try to run Write-Zip it fails with the error in your post? –  Etan Reisner Jul 30 '13 at 21:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.