Link to home
Start Free TrialLog in
Avatar of bpyeo
bpyeo

asked on

Command-line zip utility

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.
Avatar of David Lee
David Lee
Flag of United States of America image

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!
Avatar of bpyeo
bpyeo

ASKER

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.
"Is there any command line zip utility ..."
Sorry, that sounded to me like you were looking for a utility to do this.
Avatar of bpyeo

ASKER

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.
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.
Avatar of bpyeo

ASKER

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.
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
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
Avatar of bpyeo

ASKER

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.
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.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Kane - TechSoEasy
Jeffrey Kane - TechSoEasy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
Compress works OK on the Command Line but it within an ASP .Net web application it is not working