Solved

Using COMPRESS on Windows 2003 command prompt

Posted on 2009-05-19
5
709 Views
Last Modified: 2012-05-07
I want to run a task scheduler to compress all files on a folder.  There should be more than one file and I would like to use COMPRESS function on a batch program to do it.

I want to compress all following files to a single ZIP file called "myfiles.zip"

file1.csv
file2.csv
file3.csv

all compress to myfiles.zip by using COMPRESS command line.
I do not want to use 3rd party software.
0
Comment
Question by:KANEWONG
  • 3
  • 2
5 Comments
 
LVL 26

Expert Comment

by:Pber
Comment Utility
Try this in a batch file:
 Compress -Z *.csv myfiles.zp
You may need to add some paths to the files:
 Compress -Z c:\somefolder\*.csv c:\someotherfolder\myfiles.zp
0
 
LVL 1

Author Comment

by:KANEWONG
Comment Utility
it said, the destination directory is not found when I tried below syntax.

compress -Z d:\test\*.csv d:\test\myzip.zip
0
 
LVL 26

Expert Comment

by:Pber
Comment Utility
Compress is limited in its functionality.  It's made for compressing single files or compressing to folders.
 
See this:http://technet.microsoft.com/en-us/library/cc757759.aspx
http://windowsitpro.com/article/articleid/85647/jsi-tip-10375-the-compressexe-resource-kit-utility.html
So what you want to do can't be done with Compress.exe
However, you can get a free tool like 7zip: http://www.7-zip.org/
Install that, then you can issue this command:
C:\Program Files\7-Zip>7z a d:\test\myzip.zip d:\test\*.csv
0
 
LVL 1

Author Comment

by:KANEWONG
Comment Utility
I found that if I use the following command, I can compress it to some ??_ compressed file.

compress -R d:\test\*.csv d:\test\*.zip d:\test

Alll *.csv file becomes *.cs_ file.

How can I decompress it?
0
 
LVL 26

Accepted Solution

by:
Pber earned 250 total points
Comment Utility
That just compresses each file with LZH compress.  Compress.exe is used for compressing DLLs and such that is used in Windows distributions.  I.e.  all the files on the Windows OS CDs.
The format to uncompress is:
 
expand -r *.cs_
You may get errors if the files same file names are already in that folder
In that case do this:
expand -r *.cs_ d:\test\newfolder
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now