Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using COMPRESS on Windows 2003 command prompt

Posted on 2009-05-19
5
Medium Priority
?
775 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 1000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

722 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