Solved

Using COMPRESS on Windows 2003 command prompt

Posted on 2009-05-19
5
721 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
ID: 24433171
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
ID: 24434906
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
ID: 24435141
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
ID: 24435323
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
ID: 24435434
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Learn about cloud computing and its benefits for small business owners.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

24 Experts available now in Live!

Get 1:1 Help Now