Solved

Using COMPRESS on Windows 2003 command prompt

Posted on 2009-05-19
5
734 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Event ID: 1202 / Source: SceCli 6 107
Backup DHCP Server 8 108
Connecting two servers 30 83
Alert on Server memory 2 23
Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

810 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