Solved

Using COMPRESS on Windows 2003 command prompt

Posted on 2009-05-19
5
765 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

615 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