?
Solved

Command-line zip utility

Posted on 2005-05-13
14
Medium Priority
?
14,838 Views
Last Modified: 2011-11-29
Hi Experts, I am running MS Server 2003 Enterprise Edition. In the server platform, I could right-click on any folder that I want to zip and select Send To, then select compressed (zipped) folder. Now I want to schedule zip process via the scheduler. Is there any command line zip utility that is available in this platform so that I could write the script to zip all the necessary folder using the scheduler.

Please advice.

TIA.
0
Comment
Question by:bpyeo
  • 4
  • 3
  • 2
  • +4
14 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 13994520
Hi bpyeo,

Both PKZIP (http://www.pkware.com/store/PKWARE-Command_Line_Interface.php) and WINZIP (http://www.winzip.com/downcl.htm) offer command-line interfaces to their zipping products.

Cheers!
0
 

Author Comment

by:bpyeo
ID: 14000861
I do aware that 3rd party software allows command line zip. However I want to tap on the zipping capabilities of Windows 2003 server. Furthermore it is very difficult for me to justify when Windows 2003 server provides this functionality. However I only know how to activate this functionality via GUI, and not via command line. Therefore I would like to know how to activate this zipping functionality via command line in Windows 2003 server platform.

TIA.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 14000890
"Is there any command line zip utility ..."
Sorry, that sounded to me like you were looking for a utility to do this.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:alimu
ID: 14001053
0
 

Author Comment

by:bpyeo
ID: 14001277
Hi alimu, I have tried the compact command. It is simply compressed the folder/subfolder. It is equivalent to right-click on the folder, select Properties -> Advanced, check "Compress content to save disk space" and finally click on Apply button. This is not what I wanted. I want to right-click on any folder that I want to zip and select Send To, then select compressed (zipped) folder using command line.

Please advice.

TIA.
0
 
LVL 14

Expert Comment

by:alimu
ID: 14001341
I'm pretty sure you can't do that.  The way zip has been implemented in xp/2003 is as an extension to windows explorer, it works by calling methods in a dll and doesn't seem to have commandline support from what I've seen.
You'll have to look at either the compress utility (which by the way only works if you're using NTFS),
or pkzip / winzip / other command-line add-ons.
sorry to be the bearer of bad tidings.
AJ.
0
 

Author Comment

by:bpyeo
ID: 14001374
Hi alimu, as you have mentioned compress utility, could you advice me on the command? I have tried to type compress in the prompt and it does not work. The file system in the server is already NTFS.

TIA.
0
 
LVL 14

Expert Comment

by:alimu
ID: 14001384
sorry - I meant compact (it's Saturday - my brains a bit scrambled - apologies).
The command line reference is in the link I posted earlier which you said you had tried.
basically to compact a directory
compact /c /s:c:\temp\junk
to uncompact
compact /u /s:c:\temp\junk
0
 
LVL 74

Expert Comment

by:Jeffrey Kane - TechSoEasy
ID: 14001688
Hi bpyeo,

The command is "compress"  
Syntax:

   COMPRESS [-R] [-D] [-S] [ -Z | -ZX ] Source Destination
   COMPRESS -R [-D] [-S] [ -Z | -ZX ] Source [Destination]

Description:
   Compresses one or more files.

Parameter List:
   -R           Rename compressed files.

   -D           Update compressed files only if out of date.

   -S           Suppress copyright information.

   -ZX          LZX compression. This is default compression.

   -Z           MS-ZIP compression.

   Source       Source file specification. Wildcards may be
                used.

   Destination  Destination file | path specification.
                Destination may be a directory. If Source is
                multiple files and -r is not specified,
                Destination must be a directory.

Examples:
    COMPRESS temp.txt compressed.txt
    COMPRESS -R *.*
    COMPRESS -R *.exe *.dll compressed_dir

Good Luck!

Jeff
TechSoEasy
0
 

Author Comment

by:bpyeo
ID: 14001789
Hi TechSoEasy, I have tried the command "compress" and it is not found. I have tried all your 3 examples and it reports with the same error that reads: "compress is not recognized as an internal or external command, operable program or batch file". Please advice me where this command is being found.

TIA.
0
 
LVL 7

Expert Comment

by:CiaranDolan
ID: 14004240
Compress isn't installed by default - I think I found it in the resource kit. It's compresion ratio is rubbish though!

Try 7-zip (http://www.7-zip.org/) instead!

You can also use gnupg if you want to compress and encrypt.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Kane - TechSoEasy earned 500 total points
ID: 14004464
Yes, it is in the resource kit.  This describes all available windows tools:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/3c2723eb-99f0-4973-ae27-e8d3911f0409.mspx

Resource kit is here:  http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

I agree that it's compression ratio isn't as good as some other third-party tools, however the request was for not using those.

Jeff
TechSoEasy
0
 

Expert Comment

by:StuppBridge
ID: 33876690
I tried this solution, however the resulting file is not a vaild ZIP file. I can not open it afterwards, even if i change the extention to .ZIP. Any additional thoughts on this?
0
 

Expert Comment

by:oaktonpublishing
ID: 37209840
Compress works OK on the Command Line but it within an ASP .Net web application it is not working
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question