Solved

File compression using WINRAR command line utility on Windows Server 2003 machine

Posted on 2011-03-08
5
808 Views
Last Modified: 2013-12-01
I have to write a batch file to use WinRAR cmd line utility which creates an archive in .zip format, which can be opened by any machine without WinRAR. I also need to copy the list of files archived to a .txt file, which will act as a log file for me to see whether the operation was successful or not. I was able to create a .rar file using rar.exe and was able to redirect the output to a .txt file using

"C:\Program Files\WinRAR\rar.exe" a -m5 -ed "c:\Supreeth\resources.rar" "C:\Projects\MyProject\resources" >"c:\Supreeth\log.txt"

However, the resources.rar requires only WinRAR to extract. All the files archived were added in log.txt.
I used
"C:\Program Files\WinRAR\winrar.exe" a -afzip -m5 -ed "c:\Supreeth\resources.zip" "C:\Proje
cts\MyProject\resources" >"C:\Supreeth\log.txt"
The resources.zip file created can be opened by a machine which doesn't have winrar. But, I was not able to log all the files archived.

I want to create a .zip file and log the files archived as well. Please help

0
Comment
Question by:supreeths84
  • 2
5 Comments
 
LVL 3

Expert Comment

by:VespaMaru
ID: 35075034
I haven't used win-rar lately, but 7Zip can do what you want.  It is a Free open source archiver that supports Zip, Rar and many other formats.


C:\Program Files\7-Zip>7z a -tzip -mx5 c:\Supreeth\resources.zip C:\Proje
cts\MyProject\resource > C:\Supreeth\log.txt

This command should work.
7Zip can be found at:
http://sourceforge.net/projects/sevenzip/
0
 

Author Comment

by:supreeths84
ID: 35075078
I was using 7-zip all these days. But the file size grew beyond 6 GB and 7-zip is giving me an error saying "Can't allocate enough memory". So, I was looking for other compression utils and WinRAR was able to compress my file which was more than 6 GB. Can you please help me with this?
0
 
LVL 3

Accepted Solution

by:
VespaMaru earned 500 total points
ID: 35075454
This may be a weird hack, I downloaded WinRAR to test it out, but I can not seem to find a way to get WinRAR to list files or play nice with archives that are not RAR format.  Perhaps you can compress with WinRAR then test the archive with 7Zip.

Example:
start /w "C:\Program Files\WinRAR\winrar.exe" a -afzip -v -m5 -ed c:\Supreeth\resources.zip C:\Projects\MyProject\resource && "C:\Program Files\7-Zip\7z.exe" t  c:\Supreeth\resources.zip > C:\Supreeth\log.txt

Since the archive will already exist, you should be able to avoid the memory allocation issues. You can add " -ilogc:\Supreeth\ErrorLog.txt " if you are worried that WinRAR may encounter an error.
0
 
LVL 27

Expert Comment

by:Tolomir
ID: 35381948
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
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

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

26 Experts available now in Live!

Get 1:1 Help Now